/*
 * Copyright 2020 HPB Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.hpb.bc.contracts;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;

import io.hpb.web3.abi.EventEncoder;
import io.hpb.web3.abi.FunctionEncoder;
import io.hpb.web3.abi.TypeReference;
import io.hpb.web3.abi.datatypes.Address;
import io.hpb.web3.abi.datatypes.Bool;
import io.hpb.web3.abi.datatypes.DynamicArray;
import io.hpb.web3.abi.datatypes.Event;
import io.hpb.web3.abi.datatypes.Function;
import io.hpb.web3.abi.datatypes.Type;
import io.hpb.web3.abi.datatypes.Utf8String;
import io.hpb.web3.abi.datatypes.generated.Bytes32;
import io.hpb.web3.abi.datatypes.generated.Uint256;
import io.hpb.web3.crypto.Credentials;
import io.hpb.web3.protocol.Web3;
import io.hpb.web3.protocol.core.DefaultBlockParameter;
import io.hpb.web3.protocol.core.RemoteCall;
import io.hpb.web3.protocol.core.methods.request.HpbFilter;
import io.hpb.web3.protocol.core.methods.response.Log;
import io.hpb.web3.protocol.core.methods.response.TransactionReceipt;
import io.hpb.web3.tuples.generated.Tuple2;
import io.hpb.web3.tuples.generated.Tuple3;
import io.hpb.web3.tuples.generated.Tuple4;
import io.hpb.web3.tx.Contract;
import io.hpb.web3.tx.RawTransactionManager;
import io.hpb.web3.tx.TransactionManager;
import io.hpb.web3.tx.gas.ContractGasProvider;
import io.hpb.web3.tx.gas.StaticGasProvider;

import rx.Observable;
import rx.functions.Func1;

@SuppressWarnings({"unchecked", "rawtypes"})
public class Hpbballot extends Contract {
    private static final String BINARY = "60c0604052601460808190527f48706242616c6c6f742d323031382d30392d323000000000000000000000000060a09081526200004091600091906200047f565b506000600181815560029190915560038190556006600455600a805460ff191690911790556040516080806200670583398101604090815281516020830151918301516060909301519092908284106200009957600080fd5b600c805433600160a060020a031991821617918290556001868155600286905560098590556003849055600160a060020a039092166000818152600b60205260409020805490921617905560078590556005805491620000fc9190830162000504565b506007805460009081526006602052604081208190559054600580549192909181106200012557fe5b600091825260208220600690910201919091556005805443929081106200014857fe5b9060005260206000209060060201600101819055506000600560008154811015156200017057fe5b600091825260208083203384526005600690930201820190526040822092909255815481106200019c57fe5b906000526020600020906006020160040160806040519081016040528033600160a060020a031681526020016000815260200160008152602001600060405190808252806020026020018201604052801562000202578160200160208202803883390190505b50905281546001808201808555600094855260209485902084516005909402018054600160a060020a031916600160a060020a03909416939093178355838501519183019190915560408301516002830155606083015180519194620002719260038501929091019062000538565b505050506000600560008154811015156200028857fe5b6000918252602080832033845260036006909302019190910190526040812091909155600580549091908110620002bb57fe5b906000526020600020906006020160020160a06040519081016040528033600160a060020a031681526020016040805190810160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525081526020016040805190810160405280600181526020017f3000000000000000000000000000000000000000000000000000000000000000815250815260200160008152602001600060405190808252806020026020018201604052801562000390578160200160208202803883390190505b50905281546001808201808555600094855260209485902084516007909402018054600160a060020a031916600160a060020a039094169390931783558385015180519195620003e6938501929101906200047f565b5060408201518051620004049160028401916020909101906200047f565b5060608201516003820155608082015180516200042c91600484019160209091019062000538565b50506001546040805191825260208201879052818101869052518493507f2d7ed3453cffce647fa41d29c8ef6ccf907862cc1e045abde437ccd0b52e6e3b92509081900360600190a25050505062000785565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620004c257805160ff1916838001178555620004f2565b82800160010185558215620004f2579182015b82811115620004f2578251825591602001919060010190620004d5565b50620005009291506200059e565b5090565b8154818355818111156200053357600602816006028360005260206000209182019101620005339190620005be565b505050565b82805482825590600052602060002090810192821562000590579160200282015b82811115620005905782518254600160a060020a031916600160a060020a0390911617825560209092019160019091019062000559565b506200050092915062000603565b620005bb91905b80821115620005005760008155600101620005a5565b90565b620005bb91905b808211156200050057600080825560018201819055620005e960028301826200062a565b620005f960048301600062000650565b50600601620005c5565b620005bb91905b8082111562000500578054600160a060020a03191681556001016200060a565b50805460008255600702906000526020600020908101906200064d919062000673565b50565b50805460008255600502906000526020600020908101906200064d9190620006d6565b620005bb91905b8082111562000500578054600160a060020a03191681556000620006a260018301826200071d565b620006b26002830160006200071d565b6003820160009055600482016000620006cc919062000765565b506007016200067a565b620005bb91905b8082111562000500578054600160a060020a03191681556000600182018190556002820181905562000713600383018262000765565b50600501620006dd565b50805460018160011615610100020316600290046000825580601f106200074557506200064d565b601f0160209004906000526020600020908101906200064d91906200059e565b50805460008255906000526020600020908101906200064d91906200059e565b615f7080620007956000396000f30060806040526004361061027b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416623259ea81146102b357806306fdde03146103a6578063083c6323146104305780630ddf0c41146104575780630e2a273f146104fe578063146ca5311461051357806315cf7a351461052857806317d6de15146105e55780631ca9fb9d146106735780631e22648a146106945780631f8f69e3146106b857806323cafc3d146106cd57806327e1f7df1461079457806328bc5ee4146107b55780633108bd87146107ca57806333a581d2146108585780633d4053421461086d5780633e1b0d2914610885578063452323701461089d57806348cd4cb1146108cb578063521e5770146108e057806354fd4d50146108f557806358b255ea1461090a5780635b68a49d1461092b5780635cfc1a511461094f5780635dc824b9146109645780636785a8f61461098857806370480275146109ed5780637430faf414610a0e5780637973c57f14610a265780637e49d53014610a4a5780638742fc3b14610a625780638b073bb314610a775780638da5cb5b14610a8f5780639b624e7b14610ac0578063a0f3a90e14610ad8578063a6ba250c14610aed578063abe6c54d14610b11578063b922394614610b32578063c90189e414610b47578063cd197ff614610bed578063ce53ee2d14610c0e578063da280fe514610c38578063dbbc830b14610c4d578063e22a623114610c6e578063e8ee8c7514610d13578063f057235714610d37578063f0616faa14610d4f578063f206e7c914610d78578063f2fde38b14610d90578063f52adcdf14610db1578063f924c27614610dc9578063fe23583d14610de1575b60408051348152905133917f7129701436f0cdc265d1e2cda298e8a1ccd6ed5fce7f69343e16530b07a2e06e919081900360200190a2005b3480156102bf57600080fd5b506102c8610e02565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b838110156103105781810151838201526020016102f8565b50505050905001848103835286818151815260200191508051906020019060200280838360005b8381101561034f578181015183820152602001610337565b50505050905001848103825285818151815260200191508051906020019060200280838360005b8381101561038e578181015183820152602001610376565b50505050905001965050505050505060405180910390f35b3480156103b257600080fd5b506103bb6111b9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103f55781810151838201526020016103dd565b50505050905090810190601f1680156104225780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561043c57600080fd5b50610445611247565b60408051918252519081900360200190f35b34801561046357600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526104fc958335600160a060020a031695369560449491939091019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375094975061124d9650505050505050565b005b34801561050a57600080fd5b5061044561147e565b34801561051f57600080fd5b50610445611498565b34801561053457600080fd5b5061054c600160a060020a036004351660243561149e565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015610590578181015183820152602001610578565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156105cf5781810151838201526020016105b7565b5050505090500194505050505060405180910390f35b3480156105f157600080fd5b50604080516020600480358082013583810280860185019096528085526104fc95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506117629650505050505050565b34801561067f57600080fd5b506104fc6004356024356044356064356117e7565b3480156106a057600080fd5b506104fc600160a060020a0360043516602435611867565b3480156106c457600080fd5b5061054c611b30565b3480156106d957600080fd5b50604080516020600480358082013583810280860185019096528085526104fc95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750611b579650505050505050565b3480156107a057600080fd5b506104fc600160a060020a0360043516611c02565b3480156107c157600080fd5b506104fc611c66565b3480156107d657600080fd5b50604080516020600480358082013583810280860185019096528085526104fc95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750611c839650505050505050565b34801561086457600080fd5b50610445611ce2565b34801561087957600080fd5b506102c8600435611ce8565b34801561089157600080fd5b506102c8600435612074565b3480156108a957600080fd5b506108b26122ee565b6040805192835260208301919091528051918290030190f35b3480156108d757600080fd5b5061044561230d565b3480156108ec57600080fd5b50610445612313565b34801561090157600080fd5b5061044561233b565b34801561091657600080fd5b50610445600160a060020a0360043516612341565b34801561093757600080fd5b506104fc600160a060020a0360043516602435612365565b34801561095b57600080fd5b50610445612385565b34801561097057600080fd5b506104fc600160a060020a036004351660243561238b565b34801561099457600080fd5b5061099d6124fb565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156109d95781810151838201526020016109c1565b505050509050019250505060405180910390f35b3480156109f957600080fd5b506104fc600160a060020a0360043516612563565b348015610a1a57600080fd5b506104456004356125a4565b348015610a3257600080fd5b50610445600160a060020a03600435166024356125dd565b348015610a5657600080fd5b506108b26004356126c2565b348015610a6e57600080fd5b506102c86127e8565b348015610a8357600080fd5b506104fc600435612a16565b348015610a9b57600080fd5b50610aa461369c565b60408051600160a060020a039092168252519081900360200190f35b348015610acc57600080fd5b506104fc6004356136ab565b348015610ae457600080fd5b506104456136c7565b348015610af957600080fd5b5061054c600160a060020a03600435166024356136cd565b348015610b1d57600080fd5b506104fc600160a060020a0360043516613998565b348015610b3e57600080fd5b506104fc6139cd565b348015610b5357600080fd5b50610b5f6004356139ea565b604051808581526020018481526020018060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015610baf578181015183820152602001610b97565b50505050905001838103825284818151815260200191508051906020019060200280838360008381101561038e578181015183820152602001610376565b348015610bf957600080fd5b5061054c600160a060020a0360043516613ccf565b348015610c1a57600080fd5b506104fc600160a060020a0360043581169060243516604435613cf8565b348015610c4457600080fd5b506104fc613e02565b348015610c5957600080fd5b50610aa4600160a060020a0360043516613e35565b348015610c7a57600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526104fc958335600160a060020a031695369560449491939091019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750613e509650505050505050565b348015610d1f57600080fd5b506104fc600160a060020a036004351660243561417d565b348015610d4357600080fd5b50610445600435614970565b348015610d5b57600080fd5b50610d6461498f565b604080519115158252519081900360200190f35b348015610d8457600080fd5b5061054c600435614998565b348015610d9c57600080fd5b506104fc600160a060020a0360043516614b95565b348015610dbd57600080fd5b506108b2600435614bce565b348015610dd557600080fd5b50610445600435614bfa565b348015610ded57600080fd5b5061054c600160a060020a0360043516614c1f565b6060806060600080606060006001544310151515610e1f57600080fd5b6007546000908152600660205260409020546004549094508411610e4257600080fd5b60085460001015610e6057610e556127e8565b9650965096506111b0565b60016005600454815481101515610e7357fe5b600091825260209091206002600690920201015411610e9157600080fd5b60016005600454815481101515610ea457fe5b90600052602060002090600602016002018054905003925082604051908082528060200260200182016040528015610ef657816020015b610ee3615b44565b815260200190600190039081610edb5790505b509150600190505b8281116111a75760a0604051908101604052806005600454815481101515610f2257fe5b906000526020600020906006020160020183815481101515610f4057fe5b600091825260209182902060079091020154600160a060020a031682526004546005805493909201928110610f7157fe5b906000526020600020906006020160020183815481101515610f8f57fe5b90600052602060002090600702016001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110345780601f1061100957610100808354040283529160200191611034565b820191906000526020600020905b81548152906001019060200180831161101757829003601f168201915b50505050508152602001600560045481548110151561104f57fe5b90600052602060002090600602016002018381548110151561106d57fe5b600091825260209182902060026007909202018101805460408051601f6000196101006001861615020190931694909404918201859004850284018501905280835291929091908301828280156111055780601f106110da57610100808354040283529160200191611105565b820191906000526020600020905b8154815290600101906020018083116110e857829003601f168201915b50505050508152602001600560045481548110151561112057fe5b90600052602060002090600602016002018381548110151561113e57fe5b90600052602060002090600702016003015481526020016000604051908082528060200260200182016040528015611180578160200160208202803883390190505b50905282518390600019840190811061119557fe5b60209081029091010152600101610efe565b610e5582614c3f565b50505050909192565b6000805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561123f5780601f106112145761010080835404028352916020019161123f565b820191906000526020600020905b81548152906001019060200180831161122257829003601f168201915b505050505081565b60025481565b600c54600090600160a060020a0316331461126757600080fd5b60015443101561127657600080fd5b6007546000908152600660205260409020541561129257600080fd5b6005805460009081106112a157fe5b60009182526020808320600160a060020a03881684526003600690930201919091019052604090205490508015156112d857600080fd5b82600560008154811015156112e957fe5b90600052602060002090600602016002018281548110151561130757fe5b9060005260206000209060070201600201908051906020019061132b929190615b7d565b50816005600081548110151561133d57fe5b90600052602060002090600602016002018281548110151561135b57fe5b9060005260206000209060070201600101908051906020019061137f929190615b7d565b50826040518082805190602001908083835b602083106113b05780518252601f199092019160209182019101611391565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208183528851838301528851909650600160a060020a038b1695507fb7d916fe8aaa2c1a9f7198192f7afee2738483bf1453c9325b074cdc9f15cd08948994508392908301919085019080838360005b8381101561143e578181015183820152602001611426565b50505050905090810190601f16801561146b5780820380516001836020036101000a031916815260200191505b509250505060405180910390a350505050565b60015460009043101561149057600080fd5b506008545b90565b60045481565b6060806000806000606080600060015443101515156114bc57600080fd5b60008981526006602052604090205495508515156114ff576005805460009081106114e357fe5b600091825260209091206006909102015489146114ff57600080fd5b600580548790811061150d57fe5b60009182526020808320600160a060020a038e168452600360069093020191909101905260408120549550851161154357600080fd5b600160058781548110151561155457fe5b90600052602060002090600602016002018681548110151561157257fe5b906000526020600020906007020160040180549050039350836040519080825280602002602001820160405280156115b4578160200160208202803883390190505b509250836040519080825280602002602001820160405280156115e1578160200160208202803883390190505b509150600190505b83811161174e5760058054879081106115fe57fe5b90600052602060002090600602016002018581548110151561161c57fe5b9060005260206000209060070201600501600060058881548110151561163e57fe5b90600052602060002090600602016002018781548110151561165c57fe5b90600052602060002090600702016004018381548110151561167a57fe5b6000918252602080832090910154600160a060020a031683528201929092526040019020548251839060001984019081106116b157fe5b6020908102909101015260058054879081106116c957fe5b9060005260206000209060060201600201858154811015156116e757fe5b90600052602060002090600702016004018181548110151561170557fe5b6000918252602090912001548351600160a060020a03909116908490600019840190811061172f57fe5b600160a060020a039092166020928302909101909101526001016115e9565b8282975097505b5050505050509250929050565b336000908152600b6020526040812054600160a060020a0316151561178657600080fd5b60015443101561179557600080fd5b5060005b82518110156117e2576117da83828151811015156117b357fe5b9060200190602002015183838151811015156117cb57fe5b90602001906020020151611867565b600101611799565b505050565b600c54600160a060020a031633146117fe57600080fd5b82841061180a57600080fd5b60018490556002839055600982905560038190556040805185815260208101859052808201849052905182917f2d7ed3453cffce647fa41d29c8ef6ccf907862cc1e045abde437ccd0b52e6e3b919081900360600190a250505050565b336000908152600b60205260408120548190600160a060020a0316151561188d57600080fd5b60015443101561189c57600080fd5b600083116118a957600080fd5b6007546000908152600660205260409020546005805491935090839081106118cd57fe5b60009182526020808320600160a060020a0388168452600560069093020191909101905260409020549050801515611aa657600580548390811061190d57fe5b90600052602060002090600602016004018054905090508060058381548110151561193457fe5b60009182526020808320600160a060020a038916845260056006909302018201905260409091209190915580548390811061196b57fe5b906000526020600020906006020160040160806040519081016040528086600160a060020a031681526020018581526020016000815260200160006040519080825280602002602001820160405280156119cf578160200160208202803883390190505b50905281546001808201808555600094855260209485902084516005909402018054600160a060020a031916600160a060020a03909416939093178355838501519183019190915560408301516002830155606083015180519194611a3c92600385019290910190615bfb565b50505050600582815481101515611a4f57fe5b906000526020600020906006020160040181815481101515611a6d57fe5b6000918252602080832060036005909302019190910180546001810182559083529120018054600160a060020a03191633179055611aea565b82600583815481101515611ab657fe5b906000526020600020906006020160040182815481101515611ad457fe5b9060005260206000209060050201600101819055505b604080518481529051600160a060020a0386169184917f15279b02b48fe4e16a6f5fb6fd607e0b1b801e93d4526fd746f3c9f4ecfe1aa39181900360200190a350505050565b6060806001544310151515611b4457600080fd5b611b4f600754614998565b915091509091565b336000908152600b6020526040812054600160a060020a03161515611b7b57600080fd5b600154431015611b8a57600080fd5b5060005b8351811015611bef57611be78482815181101515611ba857fe5b906020019060200201518483815181101515611bc057fe5b906020019060200201518484815181101515611bd857fe5b90602001906020020151613cf8565b600101611b8e565b5050600a805460ff191660011790555050565b600c54600160a060020a03163314611c1957600080fd5b600160a060020a038082166000908152600b6020526040902054161515611c3f57600080fd5b600160a060020a03166000908152600b602052604090208054600160a060020a0319169055565b600c54600160a060020a03163314611c7d57600080fd5b43600155565b600154600090431015611c9557600080fd5b5060005b82518110156117e257611cda8382815181101515611cb357fe5b906020019060200201518383815181101515611ccb57fe5b9060200190602002015161238b565b600101611c99565b60001981565b6060806060600080606080606060006001544310151515611d0857600080fd5b60008a8152600660205260409020549550851515611d4b57600580546000908110611d2f57fe5b60009182526020909120600690910201548a14611d4b57600080fd5b6001600587815481101515611d5c57fe5b600091825260209091206002600690920201015411611d7a57600080fd5b6001600587815481101515611d8b57fe5b90600052602060002090600602016002018054905003945084604051908082528060200260200182016040528015611dcd578160200160208202803883390190505b50935084604051908082528060200260200182016040528015611dfa578160200160208202803883390190505b50925084604051908082528060200260200182016040528015611e27578160200160208202803883390190505b509150600190505b848111612064576005805487908110611e4457fe5b906000526020600020906006020160020181815481101515611e6257fe5b60009182526020909120600790910201548451600160a060020a039091169085906000198401908110611e9157fe5b600160a060020a0390921660209283029091019091015260058054611f88919088908110611ebb57fe5b906000526020600020906006020160020182815481101515611ed957fe5b90600052602060002090600702016001018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611f7e5780601f10611f5357610100808354040283529160200191611f7e565b820191906000526020600020905b815481529060010190602001808311611f6157829003601f168201915b5050505050615041565b8360018303815181101515611f9957fe5b6020908102909101015260058054612041919088908110611fb657fe5b906000526020600020906006020160020182815481101515611fd457fe5b600091825260209182902060026007909202018101805460408051601f600019610100600186161502019093169490940491820185900485028401850190528083529192909190830182828015611f7e5780601f10611f5357610100808354040283529160200191611f7e565b826001830381518110151561205257fe5b60209081029091010152600101611e2f565b5091989097509095509350505050565b606080606060008060608060606000600154431015151561209457600080fd5b60008a81526006602052604090205495508515156120d7576005805460009081106120bb57fe5b60009182526020909120600690910201548a146120d757600080fd5b60016005878154811015156120e857fe5b60009182526020909120600460069092020101541161210657600080fd5b600160058781548110151561211757fe5b90600052602060002090600602016004018054905003945084604051908082528060200260200182016040528015612159578160200160208202803883390190505b50935084604051908082528060200260200182016040528015612186578160200160208202803883390190505b509250846040519080825280602002602001820160405280156121b3578160200160208202803883390190505b509150600190505b8481116120645760058054879081106121d057fe5b9060005260206000209060060201600401818154811015156121ee57fe5b60009182526020909120600590910201548451600160a060020a03909116908590600019840190811061221d57fe5b600160a060020a03909216602092830290910190910152600580548790811061224257fe5b90600052602060002090600602016004018181548110151561226057fe5b906000526020600020906005020160010154836001830381518110151561228357fe5b60209081029091010152600580548790811061229b57fe5b9060005260206000209060060201600401818154811015156122b957fe5b90600052602060002090600502016002015482600183038151811015156122dc57fe5b602090810290910101526001016121bb565b600080600154431015151561230257600080fd5b611b4f6007546126c2565b60015481565b60015460009043101561232557600080fd5b5060075460009081526006602052604090205490565b60035481565b60015460009043101561235357600080fd5b61235f826007546125dd565b92915050565b60015443101561237457600080fd5b6123818282600754615048565b5050565b60095481565b600080600080600060015443101515156123a457600080fd5b600a5460ff1615156001146123b857600080fd5b3394508415156123c757600080fd5b600160a060020a03871615156123dc57600080fd5b843b935083156123eb57600080fd5b863b925082156123fa57600080fd5b60075460009081526006602052604090205460058054919350908390811061241e57fe5b60009182526020808320600160a060020a038916845260056006909302019190910190526040902054905080151561245557600080fd5b856124dc60058481548110151561246857fe5b90600052602060002090600602016004018381548110151561248657fe5b9060005260206000209060050201600101546005858154811015156124a757fe5b9060005260206000209060060201600401848154811015156124c557fe5b9060005260206000209060050201600201546153c5565b10156124e757600080fd5b6124f28782886153da565b50505050505050565b60015460609043101561250d57600080fd5b600880548060200260200160405190810160405280929190818152602001828054801561255957602002820191906000526020600020905b815481526020019060010190808311612545575b5050505050905090565b600c54600160a060020a0316331461257a57600080fd5b600160a060020a03166000818152600b602052604090208054600160a060020a0319169091179055565b6001546000904310156125b657600080fd5b60058054839081106125c457fe5b9060005260206000209060060201600001549050919050565b600080600060015443101515156125f357600080fd5b60008481526006602052604090205491508115156126365760058054600090811061261a57fe5b6000918252602090912060069091020154841461263657600080fd5b600580548390811061264457fe5b60009182526020808320600160a060020a0389168452600360069093020191909101905260408120549150811161267a57600080fd5b600580548390811061268857fe5b9060005260206000209060060201600201818154811015156126a657fe5b9060005260206000209060070201600301549250505092915050565b60008060008060015443101515156126d957600080fd5b600085815260066020526040902054915081151561271c5760058054600090811061270057fe5b6000918252602090912060069091020154851461271c57600080fd5b600580548390811061272a57fe5b6000918252602080832033845260056006909302019190910190526040902054905080151561275f57600093508392506127e1565b600580548390811061276d57fe5b90600052602060002090600602016004018181548110151561278b57fe5b9060005260206000209060050201600101546005838154811015156127ac57fe5b9060005260206000209060060201600401828154811015156127ca57fe5b906000526020600020906005020160020154935093505b5050915091565b6060806060600060608060606000600154431015151561280757600080fd5b600854604080518281526020808402820101909152909550858015612836578160200160208202803883390190505b50935084604051908082528060200260200182016040528015612863578160200160208202803883390190505b50925084604051908082528060200260200182016040528015612890578160200160208202803883390190505b509150600090505b84811015612a085760056004548154811015156128b157fe5b90600052602060002090600602016002016008828154811015156128d157fe5b90600052602060002001548154811015156128e857fe5b60009182526020909120600790910201548451600160a060020a039091169085908390811061291357fe5b600160a060020a03909216602092830290910190910152600454600580546129759290811061293e57fe5b906000526020600020906006020160020160088381548110151561295e57fe5b9060005260206000200154815481101515611fd457fe5b838281518110151561298357fe5b6020908102909101015260045460058054909190811061299f57fe5b90600052602060002090600602016002016008828154811015156129bf57fe5b90600052602060002001548154811015156129d657fe5b90600052602060002090600702016003015482828151811015156129f657fe5b60209081029091010152600101612898565b509196909550909350915050565b60008060006001544310151515612a2c57600080fd5b336000908152600b6020526040902054600160a060020a03161515612a5057600080fd5b6007548411612a5e57600080fd5b600780546000908152600660205260409020549085905560058054919450612a899060018301615c5c565b50600780546000908152600660205260409020600190940193849055546005805485908110612ab457fe5b60009182526020909120600690910201556005805443919085908110612ad657fe5b9060005260206000209060060201600101819055506000600584815481101515612afc57fe5b60009182526020808320338452600560069093020182019052604090912091909155805484908110612b2a57fe5b906000526020600020906006020160040160806040519081016040528033600160a060020a0316815260200160008152602001600081526020016000604051908082528060200260200182016040528015612b8f578160200160208202803883390190505b50905281546001808201808555600094855260209485902084516005909402018054600160a060020a031916600160a060020a03909416939093178355838501519183019190915560408301516002830155606083015180519194612bfc92600385019290910190615bfb565b5050505060045483111561323857612c12610e02565b50506008546000109050612c2557600080fd5b6005805484908110612c3357fe5b906000526020600020906006020160020160a06040519081016040528033600160a060020a031681526020016040805190810160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525081526020016040805190810160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152508152602001600081526020016000604051908082528060200260200182016040528015612d07578160200160208202803883390190505b50905281546001808201808555600094855260209485902084516007909402018054600160a060020a031916600160a060020a039094169390931783558385015180519195612d5b93850192910190615b7d565b5060408201518051612d77916002840191602090910190615b7d565b506060820151600382015560808201518051612d9d916004840191602090910190615bfb565b505050506000600584815481101515612db257fe5b600091825260208083203384526003600690930201919091019052604081209190915591505b600854821015613233576005805484908110612df057fe5b906000526020600020906006020160020160a06040519081016040528060056000815481101515612e1d57fe5b9060005260206000209060060201600201600886815481101515612e3d57fe5b9060005260206000200154815481101515612e5457fe5b60009182526020808320600790920290910154600160a060020a031683526005805493909101929091908110612e8657fe5b9060005260206000209060060201600201600886815481101515612ea657fe5b9060005260206000200154815481101515612ebd57fe5b90600052602060002090600702016001018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612f625780601f10612f3757610100808354040283529160200191612f62565b820191906000526020600020905b815481529060010190602001808311612f4557829003601f168201915b5050505050815260200160056000815481101515612f7c57fe5b9060005260206000209060060201600201600886815481101515612f9c57fe5b9060005260206000200154815481101515612fb357fe5b600091825260209182902060026007909202018101805460408051601f60001961010060018616150201909316949094049182018590048502840185019052808352919290919083018282801561304b5780601f106130205761010080835404028352916020019161304b565b820191906000526020600020905b81548152906001019060200180831161302e57829003601f168201915b50505050508152602001600081526020016000604051908082528060200260200182016040528015613087578160200160208202803883390190505b50905281546001808201808555600094855260209485902084516007909402018054600160a060020a031916600160a060020a0390941693909317835583850151805191956130db93850192910190615b7d565b50604082015180516130f7916002840191602090910190615b7d565b50606082015160038201556080820151805161311d916004840191602090910190615bfb565b5050505061312c826001615b2c565b600580548590811061313a57fe5b906000526020600020906006020160030160006005600081548110151561315d57fe5b906000526020600020906006020160020160088681548110151561317d57fe5b906000526020600020015481548110151561319457fe5b60009182526020808320600790920290910154600160a060020a0316835282019290925260400190205560058054849081106131cc57fe5b90600052602060002090600602016002016131e8836001615b2c565b815481106131f257fe5b6000918252602080832060046007909302019190910180546001818101835591845291909220018054600160a060020a031916331790559190910190612dd8565b61363f565b5060005b60058054600090811061324b57fe5b90600052602060002090600602016002018054905081101561363f57600580548490811061327557fe5b906000526020600020906006020160020160a060405190810160405280600560008154811015156132a257fe5b9060005260206000209060060201600201848154811015156132c057fe5b60009182526020808320600790920290910154600160a060020a0316835260058054939091019290919081106132f257fe5b90600052602060002090600602016002018481548110151561331057fe5b90600052602060002090600702016001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156133b55780601f1061338a576101008083540402835291602001916133b5565b820191906000526020600020905b81548152906001019060200180831161339857829003601f168201915b50505050508152602001600560008154811015156133cf57fe5b9060005260206000209060060201600201848154811015156133ed57fe5b600091825260209182902060026007909202018101805460408051601f6000196101006001861615020190931694909404918201859004850284018501905280835291929091908301828280156134855780601f1061345a57610100808354040283529160200191613485565b820191906000526020600020905b81548152906001019060200180831161346857829003601f168201915b505050505081526020016000815260200160006040519080825280602002602001820160405280156134c1578160200160208202803883390190505b50905281546001808201808555600094855260209485902084516007909402018054600160a060020a031916600160a060020a03909416939093178355838501518051919561351593850192910190615b7d565b5060408201518051613531916002840191602090910190615b7d565b506060820151600382015560808201518051613557916004840191602090910190615bfb565b505050508060058481548110151561356b57fe5b906000526020600020906006020160030160006005600081548110151561358e57fe5b9060005260206000209060060201600201848154811015156135ac57fe5b60009182526020808320600790920290910154600160a060020a0316835282019290925260400190205560058054849081106135e457fe5b90600052602060002090600602016002018181548110151561360257fe5b6000918252602080832060046007909302019190910180546001818101835591845291909220018054600160a060020a031916331790550161323c565b600a805460ff1916905560058054859190600019860190811061365e57fe5b6000918252602082206006909102015460405190917f619db8006d6d53b48518c4c84f3955a5c9051302fcf370059d9b8a2e6747233491a350505050565b600c54600160a060020a031681565b600c54600160a060020a031633146136c257600080fd5b600455565b60075481565b6060806000806000606080600060015443101515156136eb57600080fd5b600089815260066020526040902054955085151561372e5760058054600090811061371257fe5b6000918252602090912060069091020154891461372e57600080fd5b600580548790811061373c57fe5b60009182526020808320600160a060020a038e16845260056006909302019190910190526040902054945084151561378d576040805160008082526020820190815281830190925298509650611755565b600160058781548110151561379e57fe5b9060005260206000209060060201600401868154811015156137bc57fe5b906000526020600020906005020160030180549050039350836040519080825280602002602001820160405280156137fe578160200160208202803883390190505b5092508360405190808252806020026020018201604052801561382b578160200160208202803883390190505b509150600190505b83811161174e57600580548790811061384857fe5b90600052602060002090600602016004018581548110151561386657fe5b9060005260206000209060050201600401600060058881548110151561388857fe5b9060005260206000209060060201600401878154811015156138a657fe5b9060005260206000209060050201600301838154811015156138c457fe5b6000918252602080832090910154600160a060020a031683528201929092526040019020548251839060001984019081106138fb57fe5b60209081029091010152600580548790811061391357fe5b90600052602060002090600602016004018581548110151561393157fe5b90600052602060002090600502016003018181548110151561394f57fe5b6000918252602090912001548351600160a060020a03909116908490600019840190811061397957fe5b600160a060020a03909216602092830290910190910152600101613833565b600c54600160a060020a031633146139af57600080fd5b6001544310156139be57600080fd5b6139ca8160075461417d565b50565b600c54600160a060020a031633146139e457600080fd5b43600255565b60008060608060008060608060006001544310151515613a0957600080fd5b6007546000908152600660205260409020546004549095508511613a5a57604080516000808252602082019092528190815b50604080516000815260208101909152929b5090995097509550613cc3565b6005805486908110613a6857fe5b9060005260206000209060060201600101548a101515613cab576002851015613aa35760408051600080825260208201909252819081613a3b565b6002600560018703815481101515613ab757fe5b9060005260206000209060060201600201805490501015613aea5760408051600080825260208201909252819081613a3b565b6001600560018703815481101515613afe57fe5b90600052602060002090600602016002018054905003935083604051908082528060200260200182016040528015613b40578160200160208202803883390190505b50925083604051908082528060200260200182016040528015613b6d578160200160208202803883390190505b509150600190505b838111613c5757600580546000198701908110613b8e57fe5b906000526020600020906006020160020181815481101515613bac57fe5b60009182526020909120600790910201548351600160a060020a039091169084906000198401908110613bdb57fe5b600160a060020a03909216602092830290910190910152600580546000198701908110613c0457fe5b906000526020600020906006020160020181815481101515613c2257fe5b9060005260206000209060070201600301548260018303815181101515613c4557fe5b60209081029091010152600101613b75565b600580546000198701908110613c6957fe5b906000526020600020906006020160010154600586815481101515613c8a57fe5b90600052602060002090600602016001015484849850985098509850613cc3565b60408051600080825260208201909252819081613a3b565b50505050509193509193565b6060806001544310151515613ce357600080fd5b613cef836007546136cd565b91509150915091565b336000908152600b60205260408120548190600160a060020a03161515613d1e57600080fd5b600154431015613d2d57600080fd5b600754600090815260066020526040902054600580549193509083908110613d5157fe5b60009182526020808320600160a060020a0389168452600560069093020191909101905260409020549050801515613d8857600080fd5b82613d9b60058481548110151561246857fe5b1015613da657600080fd5b60408051600160a060020a0380881682528616602082015280820185905290517f2b129bbe38120d6f7daa19b088ef3d5cb903888df4358566273fb05aa22d3fa19181900360600190a1613dfb8482856153da565b5050505050565b336000908152600b6020526040902054600160a060020a03161515613e2657600080fd5b600a805460ff19166001179055565b600b60205260009081526040902054600160a060020a031681565b336000908152600b6020526040812054600160a060020a03161515613e7457600080fd5b600154431015613e8357600080fd5b60075460009081526006602052604090205415613e9f57600080fd5b600580546000908110613eae57fe5b60009182526020808320600160a060020a03881684526003600690930201919091019052604090205490508015613ee457600080fd5b600580546000908110613ef357fe5b90600052602060002090600602016002018054905090508060056000815481101515613f1b57fe5b60009182526020808320600160a060020a038916845260036006909302019190910190526040812091909155600580549091908110613f5657fe5b906000526020600020906006020160020160a06040519081016040528086600160a060020a03168152602001848152602001858152602001600081526020016000604051908082528060200260200182016040528015613fc0578160200160208202803883390190505b50905281546001808201808555600094855260209485902084516007909402018054600160a060020a031916600160a060020a03909416939093178355838501518051919561401493850192910190615b7d565b5060408201518051614030916002840191602090910190615b7d565b506060820151600382015560808201518051614056916004840191602090910190615bfb565b505050506005600081548110151561406a57fe5b90600052602060002090600602016002018181548110151561408857fe5b600091825260208083206004600790930201919091018054600181018255908352918190209091018054600160a060020a03191633179055604051845185928291908401908083835b602083106140f05780518252601f1990920191602091820191016140d1565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208183528851838301528851909650600160a060020a038b1695507fbb8d87d130360ec5b709848eac76be61e74e7490455b301ee60c6a73c35186fe948994508392908301919085019080838360008381101561143e578181015183820152602001611426565b600c54600090819081908190819081908190600160a060020a031633146141a357600080fd5b6001544310156141b257600080fd5b6000888152600660205260409020546005805491985090889081106141d357fe5b60009182526020808320600160a060020a038d16845260036006909302019190910190526040902054955085151561420a57600080fd5b600194505b600580548890811061421d57fe5b90600052602060002090600602016002018681548110151561423b57fe5b9060005260206000209060070201600401805490508510156146e757600580548890811061426557fe5b9060005260206000209060060201600501600060058981548110151561428757fe5b9060005260206000209060060201600201888154811015156142a557fe5b9060005260206000209060070201600401838154811015156142c357fe5b6000918252602080832090910154600160a060020a0316835282019290925260400181205494509250600191505b600160058881548110151561430257fe5b90600052602060002090600602016004018581548110151561432057fe5b906000526020600020906005020160030180549050038210156144af5788600160a060020a031660058881548110151561435657fe5b90600052602060002090600602016004018581548110151561437457fe5b90600052602060002090600502016003018381548110151561439257fe5b600091825260209091200154600160a060020a031614156143b1578192505b6000831180156143c15750828210155b156144a45760058054889081106143d457fe5b9060005260206000209060060201600401848154811015156143f257fe5b90600052602060002090600502016003018260010181548110151561441357fe5b60009182526020909120015460058054600160a060020a03909216918990811061443957fe5b90600052602060002090600602016004018581548110151561445757fe5b90600052602060002090600502016003018381548110151561447557fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055505b6001909101906142f1565b61454c6005888154811015156144c157fe5b9060005260206000209060060201600401858154811015156144df57fe5b90600052602060002090600502016002015460058981548110151561450057fe5b90600052602060002090600602016004018681548110151561451e57fe5b60009182526020808320600160a060020a038f168452600460059093020191909101905260409020546153c5565b600580548990811061455a57fe5b90600052602060002090600602016004018581548110151561457857fe5b906000526020600020906005020160020181905550600060058881548110151561459e57fe5b9060005260206000209060060201600401858154811015156145bc57fe5b60009182526020808320600160a060020a038e16845260059283020160040190526040909120919091558054889081106145f257fe5b90600052602060002090600602016004018481548110151561461057fe5b9060005260206000209060050201600301600160058981548110151561463257fe5b90600052602060002090600602016004018681548110151561465057fe5b9060005260206000209060050201600301805490500381548110151561467257fe5b60009182526020909120018054600160a060020a0319169055600580548890811061469957fe5b9060005260206000209060060201600401848154811015156146b757fe5b90600052602060002090600502016003018054809190600190036146db9190615c88565b5060019094019361420f565b50845b60016005888154811015156146fb57fe5b9060005260206000209060060201600201805490500381101561482a57600580548890811061472657fe5b90600052602060002090600602016002018160010181548110151561474757fe5b906000526020600020906007020160058881548110151561476457fe5b90600052602060002090600602016002018281548110151561478257fe5b6000918252602090912082546007909202018054600160a060020a031916600160a060020a03909216919091178155600180830180546147d992808501929160026000199282161561010002929092011604615cac565b50600282810180546147fe928481019291600019610100600183161502011604615cac565b5060038201548160030155600482018160040190805461481f929190615d21565b5050506001016146ea565b600580548890811061483857fe5b9060005260206000209060060201600201600160058981548110151561485a57fe5b9060005260206000209060060201600201805490500381548110151561487c57fe5b6000918252602082206007909102018054600160a060020a0319168155906148a76001830182615d61565b6148b5600283016000615d61565b60038201600090556004820160006148cd9190615da5565b505060058054889081106148dd57fe5b90600052602060002090600602016002018054809190600190036149019190615dc3565b50600060058881548110151561491357fe5b60009182526020808320600160a060020a038e1680855260069390930201600301905260408083209390935591517f6fe1c8a36bbf04217ace8c02e2469521bb21107f6f54ae5213ab312b8ae1bb6f9190a2505050505050505050565b600880548290811061497e57fe5b600091825260209091200154905081565b600a5460ff1681565b606080600080606080600060015443101515156149b457600080fd5b60008881526006602052604090205494508415156149f7576005805460009081106149db57fe5b600091825260209091206006909102015488146149f757600080fd5b6001600586815481101515614a0857fe5b600091825260209091206002600690920201015411614a2657600080fd5b6001600586815481101515614a3757fe5b90600052602060002090600602016002018054905003935083604051908082528060200260200182016040528015614a79578160200160208202803883390190505b50925083604051908082528060200260200182016040528015614aa6578160200160208202803883390190505b509150600190505b838111614b88576005805486908110614ac357fe5b906000526020600020906006020160020181815481101515614ae157fe5b60009182526020909120600790910201548351600160a060020a039091169084906000198401908110614b1057fe5b600160a060020a039092166020928302909101909101526005805486908110614b3557fe5b906000526020600020906006020160020181815481101515614b5357fe5b9060005260206000209060070201600301548260018303815181101515614b7657fe5b60209081029091010152600101614aae565b5090969095509350505050565b600c54600160a060020a03163314614bac57600080fd5b600c8054600160a060020a031916600160a060020a0392909216919091179055565b6005805482908110614bdc57fe5b60009182526020909120600690910201805460019091015490915082565b600154600090431015614c0c57600080fd5b5060009081526006602052604090205490565b6060806001544310151515614c3357600080fd5b613cef8360075461149e565b60608060608060608060008060008060006001544310151515614c6157600080fd5b8b516009541115614c7157600080fd5b600954604051908082528060200260200182016040528015614c9d578160200160208202803883390190505b509750600954604051908082528060200260200182016040528015614ccc578160200160208202803883390190505b509650600954604051908082528060200260200182016040528015614cfb578160200160208202803883390190505b5095508b6000815181101515614d0d57fe5b9060200190602002015160600151945060009350600092505b8b51831015614fad57600954831015614e2b578b83815181101515614d4757fe5b60209081029091010151518851899085908110614d6057fe5b600160a060020a039092166020928302909101909101528b51614d9c908d9085908110614d8957fe5b9060200190602002015160400151615041565b8784815181101515614daa57fe5b602090810290910101528b518c9084908110614dc257fe5b90602001906020020151606001518684815181101515614dde57fe5b6020908102909101015285518590879085908110614df857fe5b906020019060200201511015614e26578583815181101515614e1657fe5b9060200190602002015194508293505b614fa2565b848c84815181101515614e3a57fe5b90602001906020020151606001511415614e5357614fa2565b848c84815181101515614e6257fe5b90602001906020020151606001511115614fa2578b83815181101515614e8457fe5b60209081029091010151518851899086908110614e9d57fe5b600160a060020a039092166020928302909101909101528b51614ec6908d9085908110614d8957fe5b8785815181101515614ed457fe5b602090810290910101528b518c9084908110614eec57fe5b90602001906020020151606001518685815181101515614f0857fe5b60209081029091010152855186906000908110614f2157fe5b90602001906020020151945060009350600091505b8751821015614f8757848683815181101515614f4e57fe5b906020019060200201511015614f7c578582815181101515614f6c57fe5b9060200190602002015194508193505b600190910190614f36565b8584815181101515614f9557fe5b9060200190602002015194505b600190920191614d26565b5060005b875181101561502e5760086005600454815481101515614fcd57fe5b906000526020600020906006020160030160008a84815181101515614fee57fe5b6020908102909101810151600160a060020a0316825281810192909252604001600090812054835460018181018655948352929091209091015501614fb1565b50959a9499509297509295505050505050565b6020015190565b6000806000806000600154431015151561506157600080fd5b60008681526006602052604090205433955093508315156150a75760058054600090811061508b57fe5b600091825260209091206006909102015486146150a757600080fd5b60058054859081106150b557fe5b60009182526020808320600160a060020a03891684526005600690930201919091019052604090205492508215156150ec57600080fd5b60058054859081106150fa57fe5b60009182526020808320600160a060020a038c16845260036006909302019190910190526040902054915081151561513157600080fd5b600580548590811061513f57fe5b90600052602060002090600602016004018381548110151561515d57fe5b60009182526020808320600160a060020a038c1684526004600590930201919091019052604090205490508681101561519557600080fd5b61519f81886153c5565b60058054869081106151ad57fe5b9060005260206000209060060201600201838154811015156151cb57fe5b60009182526020808320600160a060020a038a168452600560079093020182019052604090912091909155805461523d91908690811061520757fe5b90600052602060002090600602016002018381548110151561522557fe5b906000526020600020906007020160030154886153c5565b600580548690811061524b57fe5b90600052602060002090600602016002018381548110151561526957fe5b90600052602060002090600702016003018190555061528881886153c5565b600580548690811061529657fe5b9060005260206000209060060201600401848154811015156152b457fe5b60009182526020808320600160a060020a038d168452600592830201600401905260409091209190915580546153259190869081106152ef57fe5b90600052602060002090600602016004018481548110151561530d57fe5b906000526020600020906005020160020154886153c5565b600580548690811061533357fe5b90600052602060002090600602016004018481548110151561535157fe5b90600052602060002090600502016002018190555087600160a060020a031685600160a060020a0316857f2713117ff36a0f7a1a5fae52b012ef9f9b6cebc41045e6fa830af08e8338f0ef8a6000604051808381526020018281526020019250505060405180910390a45050505050505050565b6000818310156153d457600080fd5b50900390565b60008060015443101515156153ee57600080fd5b600083116153fb57600080fd5b60075460009081526006602052604090205460058054919350908390811061541f57fe5b60009182526020808320600160a060020a038916845260036006909302019190910190526040902054905080151561545657600080fd5b600160058381548110151561546757fe5b90600052602060002090600602016002018281548110151561548557fe5b906000526020600020906007020160060160006005858154811015156154a757fe5b9060005260206000209060060201600401878154811015156154c557fe5b60009182526020808320600590920290910154600160a060020a03168352820192909252604001902054101561579257600160058381548110151561550657fe5b90600052602060002090600602016002018281548110151561552457fe5b9060005260206000209060070201600601600060058581548110151561554657fe5b90600052602060002090600602016004018781548110151561556457fe5b6000918252602080832060059283020154600160a060020a03168452830193909352604090910190209190915580548390811061559d57fe5b9060005260206000209060060201600201818154811015156155bb57fe5b90600052602060002090600702016004016005838154811015156155db57fe5b9060005260206000209060060201600401858154811015156155f957fe5b6000918252602080832060059283020154845460018101865594845292209092018054600160a060020a031916600160a060020a0390921691909117905580548491908490811061564657fe5b90600052602060002090600602016002018281548110151561566457fe5b9060005260206000209060070201600501600060058581548110151561568657fe5b9060005260206000209060060201600401878154811015156156a457fe5b6000918252602080832060059283020154600160a060020a0316845283019390935260409091019020919091558054839081106156dd57fe5b9060005260206000209060060201600401848154811015156156fb57fe5b60009182526020808320600592830201600301805460018101825590845292209091018054600160a060020a031916600160a060020a03881617905580548491908490811061574657fe5b90600052602060002090600602016004018581548110151561576457fe5b60009182526020808320600160a060020a038a1684526004600590930201919091019052604090205561597f565b6158326005838154811015156157a457fe5b9060005260206000209060060201600201828154811015156157c257fe5b906000526020600020906007020160050160006005858154811015156157e457fe5b90600052602060002090600602016004018781548110151561580257fe5b60009182526020808320600590920290910154600160a060020a0316835282019290925260400190205484615b2c565b600580548490811061584057fe5b90600052602060002090600602016002018281548110151561585e57fe5b9060005260206000209060070201600501600060058581548110151561588057fe5b90600052602060002090600602016004018781548110151561589e57fe5b6000918252602080832060059283020154600160a060020a03168452830193909352604090910190209190915580546159299190849081106158dc57fe5b9060005260206000209060060201600401858154811015156158fa57fe5b60009182526020808320600160a060020a038a1684526004600590930201919091019052604090205484615b2c565b600580548490811061593757fe5b90600052602060002090600602016004018581548110151561595557fe5b60009182526020808320600160a060020a038a168452600460059093020191909101905260409020555b6159c760058381548110151561599157fe5b9060005260206000209060060201600401858154811015156159af57fe5b90600052602060002090600502016002015484615b2c565b60058054849081106159d557fe5b9060005260206000209060060201600401858154811015156159f357fe5b906000526020600020906005020160020181905550615a50600583815481101515615a1a57fe5b906000526020600020906006020160020182815481101515615a3857fe5b90600052602060002090600702016003015484615b2c565b6005805484908110615a5e57fe5b906000526020600020906006020160020182815481101515615a7c57fe5b90600052602060002090600702016003018190555084600160a060020a0316600583815481101515615aaa57fe5b906000526020600020906006020160040185815481101515615ac857fe5b600091825260209182902060059091020154604080518781526001938101939093528051600160a060020a039092169286927f2713117ff36a0f7a1a5fae52b012ef9f9b6cebc41045e6fa830af08e8338f0ef929181900390910190a45050505050565b60008160001903831115615b3f57600080fd5b500190565b60a0604051908101604052806000600160a060020a03168152602001606081526020016060815260200160008152602001606081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10615bbe57805160ff1916838001178555615beb565b82800160010185558215615beb579182015b82811115615beb578251825591602001919060010190615bd0565b50615bf7929150615def565b5090565b828054828255906000526020600020908101928215615c50579160200282015b82811115615c505782518254600160a060020a031916600160a060020a03909116178255602090920191600190910190615c1b565b50615bf7929150615e09565b8154818355818111156117e2576006028160060283600052602060002091820191016117e29190615e2d565b8154818355818111156117e2576000838152602090206117e2918101908301615def565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10615ce55780548555615beb565b82800160010185558215615beb57600052602060002091601f016020900482015b82811115615beb578254825591600101919060010190615d06565b828054828255906000526020600020908101928215615c505760005260206000209182015b82811115615c50578254825591600101919060010190615d46565b50805460018160011615610100020316600290046000825580601f10615d8757506139ca565b601f0160209004906000526020600020908101906139ca9190615def565b50805460008255906000526020600020908101906139ca9190615def565b8154818355818111156117e2576007028160070283600052602060002091820191016117e29190615e6b565b61149591905b80821115615bf75760008155600101615df5565b61149591905b80821115615bf7578054600160a060020a0319168155600101615e0f565b61149591905b80821115615bf757600080825560018201819055615e546002830182615ec5565b615e62600483016000615ee6565b50600601615e33565b61149591905b80821115615bf7578054600160a060020a03191681556000615e966001830182615d61565b615ea4600283016000615d61565b6003820160009055600482016000615ebc9190615da5565b50600701615e71565b50805460008255600702906000526020600020908101906139ca9190615e6b565b50805460008255600502906000526020600020908101906139ca919061149591905b80821115615bf7578054600160a060020a031916815560006001820181905560028201819055615f3b6003830182615da5565b50600501615f085600a165627a7a723058200ace497a5afb2ed3ece27ec69342a32fdae3596565cb7889207a87dc7712b5d50029";

    public static final String FUNC_VOTERESULT = "voteResult";

    public static final String FUNC_NAME = "name";

    public static final String FUNC_ENDBLOCK = "endBlock";

    public static final String FUNC_UPDATECANDIDATE = "updateCandidate";

    public static final String FUNC_GETCANDIDATEINDEXARRAYLENGTH = "getCandidateIndexArrayLength";

    public static final String FUNC_ROUND = "round";

    public static final String FUNC_FECHVOTERESULTFORCANDIDATEBYSNAPSHOTBLOCK = "fechVoteResultForCandidateBySnapshotBlock";

    public static final String FUNC_SETSNAPSHOTBALANCEBATCH = "setSnapshotBalanceBatch";

    public static final String FUNC_UPDATECONTRACT = "updateContract";

    public static final String FUNC_SETSNAPSHOTBALANCE = "setSnapshotBalance";

    public static final String FUNC_FECHALLVOTERESULTFORCURRENT = "fechAllVoteResultForCurrent";

    public static final String FUNC_VOTENOLOCKBYADMINBATCH = "voteNoLockByAdminBatch";

    public static final String FUNC_DELETEADMIN = "deleteAdmin";

    public static final String FUNC_BEGINVOTE = "beginVote";

    public static final String FUNC_VOTENOLOCKBATCH = "voteNoLockBatch";

    public static final String FUNC_MAX_UINT256 = "MAX_UINT256";

    public static final String FUNC_FECHALLCANDIDATESBYSNAPSHOTBLOCK = "fechAllCandidatesBySnapshotBlock";

    public static final String FUNC_FECHALLVOTERSBYSNAPSHOTBLOCK = "fechAllVotersBySnapshotBlock";

    public static final String FUNC_FECHVOTEMAININFO = "fechVoteMainInfo";

    public static final String FUNC_STARTBLOCK = "startBlock";

    public static final String FUNC_FECHCURRENTSNAPSHOTBLOCKINDEX = "fechCurrentSnapshotBlockIndex";

    public static final String FUNC_VERSION = "version";

    public static final String FUNC_FECHVOTENUMFORCANDIDATE = "fechVoteNumForCandidate";

    public static final String FUNC_CANCELVOTEFORCANDIDATE = "cancelVoteForCandidate";

    public static final String FUNC_CAPACITY = "capacity";

    public static final String FUNC_VOTENOLOCK = "voteNoLock";

    public static final String FUNC_GETCANDIDATEINDEXARRAY = "getCandidateIndexArray";

    public static final String FUNC_ADDADMIN = "addAdmin";

    public static final String FUNC_FECHSNAPSHOTBLOCKBYINDEX = "fechSnapshotBlockByIndex";

    public static final String FUNC_FECHVOTENUMFORCANDIDATEBYSNAPSHOTBLOCK = "fechVoteNumForCandidateBySnapshotBlock";

    public static final String FUNC_FECHVOTEMAININFOBYSNAPSHOTBLOCK = "fechVoteMainInfoBySnapshotBlock";

    public static final String FUNC_GETVOTERESULT = "getVoteResult";

    public static final String FUNC_CHANGESTAGEBLOCK = "changeStageBlock";

    public static final String FUNC_OWNER = "owner";

    public static final String FUNC_SETROUND = "setRound";

    public static final String FUNC_CURRENTSNAPSHOTBLOCK = "currentSnapshotBlock";

    public static final String FUNC_FECHVOTEINFOFORVOTERBYSNAPSHOTBLOCK = "fechVoteInfoForVoterBySnapshotBlock";

    public static final String FUNC_DELETECANDIDATES = "deleteCandidates";

    public static final String FUNC_ENDVOTE = "endVote";

    public static final String FUNC_FECHALLVOTERESULTPRESTAGEBYBLOCK = "fechAllVoteResultPreStageByBlock";

    public static final String FUNC_FECHVOTEINFOFORVOTER = "fechVoteInfoForVoter";

    public static final String FUNC_VOTENOLOCKBYADMIN = "voteNoLockByAdmin";

    public static final String FUNC_RESETHASAUTOVOTE = "resetHasAutoVote";

    public static final String FUNC_ADMINMAP = "adminMap";

    public static final String FUNC_ADDCANDIDATE = "addCandidate";

    public static final String FUNC_DELETECANDIDATEBYSNAPSHOTBLOCK = "deleteCandidateBySnapshotBlock";

    public static final String FUNC_CANDIDATEINDEXARRAY = "candidateIndexArray";

    public static final String FUNC_HASAUTOVOTE = "hasAutoVote";

    public static final String FUNC_FECHALLVOTERESULTBYSNAPSHOTBLOCK = "fechAllVoteResultBySnapshotBlock";

    public static final String FUNC_TRANSFEROWNERSHIP = "transferOwnership";

    public static final String FUNC_VOTESTAGES = "voteStages";

    public static final String FUNC_FECHSTAGEINDEXBYSNAPSHOTBLOCK = "fechStageIndexBySnapshotBlock";

    public static final String FUNC_FECHVOTERESULTFORCANDIDATE = "fechVoteResultForCandidate";

    public static final Event CANDIDATEADDED_EVENT = new Event("CandidateAdded",
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>(true) {
            }, new TypeReference<Utf8String>(true) {
            }, new TypeReference<Utf8String>() {
            }));
    ;

    public static final Event CANDIDATEUPDATED_EVENT = new Event("CandidateUpdated",
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>(true) {
            }, new TypeReference<Utf8String>(true) {
            }, new TypeReference<Utf8String>() {
            }));
    ;

    public static final Event CANDIDATEDELETED_EVENT = new Event("CandidateDeleted",
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>(true) {
            }));
    ;

    public static final Event DOVOTED_EVENT = new Event("DoVoted",
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>(true) {
            }, new TypeReference<Address>(true) {
            }, new TypeReference<Address>(true) {
            }, new TypeReference<Uint256>() {
            }, new TypeReference<Uint256>() {
            }));
    ;

    public static final Event UPDATECONTRACT_EVENT = new Event("UpdateContract",
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>(true) {
            }, new TypeReference<Uint256>() {
            }, new TypeReference<Uint256>() {
            }, new TypeReference<Uint256>() {
            }));
    ;

    public static final Event CHANGESTAGEBLOCK_EVENT = new Event("ChangeStageBlock",
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>(true) {
            }, new TypeReference<Uint256>(true) {
            }));
    ;

    public static final Event SETSNAPSHOTBALANCE_EVENT = new Event("SetSnapshotBalance",
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>(true) {
            }, new TypeReference<Address>(true) {
            }, new TypeReference<Uint256>() {
            }));
    ;

    public static final Event VOTENOLOCKBYADMININVOKEDOVOTED_EVENT = new Event("VoteNoLockByAdminInvokeDoVoted",
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {
            }, new TypeReference<Address>() {
            }, new TypeReference<Uint256>() {
            }));
    ;

    public static final Event RECEIVEDHPB_EVENT = new Event("ReceivedHpb",
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>(true) {
            }, new TypeReference<Uint256>() {
            }));
    ;

    protected Hpbballot(String contractAddress, Web3 web3, Credentials credentials,
                        BigInteger gasPrice, BigInteger gasLimit) {
        super(BINARY, contractAddress, web3, new RawTransactionManager(web3, credentials), new StaticGasProvider(gasPrice, gasLimit));
    }

    protected Hpbballot(String contractAddress, Web3 web3, TransactionManager transactionManager,
                        BigInteger gasPrice, BigInteger gasLimit) {
        super(BINARY, contractAddress, web3, transactionManager, new StaticGasProvider(gasPrice, gasLimit));
    }

    protected Hpbballot(String contractAddress, Web3 web3, TransactionManager transactionManager,
                        ContractGasProvider gasProvider) {
        super(BINARY, contractAddress, web3, transactionManager, gasProvider);
    }

    public RemoteCall<TransactionReceipt> voteResult() {
        final Function function = new Function(
                FUNC_VOTERESULT,
                Arrays.<Type>asList(),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    public RemoteCall<Utf8String> name() {
        final Function function = new Function(FUNC_NAME,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {
                }));
        return executeRemoteCallSingleValueReturn(function);
    }

    // 结束投票的区块号
    public RemoteCall<Uint256> endBlock() {
        final Function function = new Function(FUNC_ENDBLOCK,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
                }));
        return executeRemoteCallSingleValueReturn(function);
    }

    /**
     * 更新候选者 updateMoreInfo Candidate
     *
     * @param _candidateAddr Candidate account address for return bond (HPB)
     * @param _facilityId    候选者机器设备号或者节点ID Candidate machine equipment number or node ID
     * @param _name          候选者名称  Candidate name
     */
    public RemoteCall<TransactionReceipt> updateCandidate(Address _candidateAddr,
                                                          Utf8String _facilityId, Utf8String _name) {
        final Function function = new Function(
                FUNC_UPDATECANDIDATE,
                Arrays.<Type>asList(_candidateAddr, _facilityId, _name),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    public RemoteCall<Uint256> getCandidateIndexArrayLength() {
        final Function function = new Function(FUNC_GETCANDIDATEINDEXARRAYLENGTH,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
                }));
        return executeRemoteCallSingleValueReturn(function);
    }

    public RemoteCall<Uint256> round() {
        final Function function = new Function(FUNC_ROUND,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
                }));
        return executeRemoteCallSingleValueReturn(function);
    }

    /**
     * 获取候选人指定阶段的投票详细情况
     */
    public RemoteCall<Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>> fechVoteResultForCandidateBySnapshotBlock(Address candidateAddr,
                                                                                                                      Uint256 _snapshotBlock) {
        final Function function = new Function(FUNC_FECHVOTERESULTFORCANDIDATEBYSNAPSHOTBLOCK,
                Arrays.<Type>asList(candidateAddr, _snapshotBlock),
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Address>>() {
                }, new TypeReference<DynamicArray<Uint256>>() {
                }));
        return new RemoteCall<Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>>(
                new Callable<Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>>() {
                    @Override
                    public Tuple2<DynamicArray<Address>, DynamicArray<Uint256>> call() throws
                            Exception {
                        List<Type> results = executeCallMultipleValueReturn(function);
                        return new Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>(
                                (DynamicArray<Address>) results.get(0),
                                (DynamicArray<Uint256>) results.get(1));
                    }
                });
    }

    /**
     * 批量设置投票人的余额快照
     */
    public RemoteCall<TransactionReceipt> setSnapshotBalanceBatch(DynamicArray<Address> voterAddrs,
                                                                  DynamicArray<Uint256> _snapshotBalances) {
        final Function function = new Function(
                FUNC_SETSNAPSHOTBALANCEBATCH,
                Arrays.<Type>asList(voterAddrs, _snapshotBalances),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    // 改变投票区间值,改变保证金最少金额,改变投票版本号
    public RemoteCall<TransactionReceipt> updateContract(Uint256 _startBlock, Uint256 _endBlock,
                                                         Uint256 _capacity, Uint256 _version) {
        final Function function = new Function(
                FUNC_UPDATECONTRACT,
                Arrays.<Type>asList(_startBlock, _endBlock, _capacity, _version),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    /**
     * 设置投票人的快照余额（以指定的区块号为准，到时候由官方或者HPB基金会对外公布）
     * Set the voter's snapshot balance (subject to the designated block number,
     * to be published by the official or HPB Foundation)
     */
    public RemoteCall<TransactionReceipt> setSnapshotBalance(Address voterAddr,
                                                             Uint256 _snapshotBalance) {
        final Function function = new Function(
                FUNC_SETSNAPSHOTBALANCE,
                Arrays.<Type>asList(voterAddr, _snapshotBalance),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    /**
     * 获取当前阶段候选人所有得票情况
     */
    public RemoteCall<Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>> fechAllVoteResultForCurrent() {
        final Function function = new Function(FUNC_FECHALLVOTERESULTFORCURRENT,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Address>>() {
                }, new TypeReference<DynamicArray<Uint256>>() {
                }));
        return new RemoteCall<Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>>(
                new Callable<Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>>() {
                    @Override
                    public Tuple2<DynamicArray<Address>, DynamicArray<Uint256>> call() throws
                            Exception {
                        List<Type> results = executeCallMultipleValueReturn(function);
                        return new Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>(
                                (DynamicArray<Address>) results.get(0),
                                (DynamicArray<Uint256>) results.get(1));
                    }
                });
    }

    /**
     * 用于批量自动投票，根据前一个轮次的投票记录程序自动投票
     */
    public RemoteCall<TransactionReceipt> voteNoLockByAdminBatch(DynamicArray<Address> voterAddrs,
                                                                 DynamicArray<Address> candidateAddrs, DynamicArray<Uint256> nums) {
        final Function function = new Function(
                FUNC_VOTENOLOCKBYADMINBATCH,
                Arrays.<Type>asList(voterAddrs, candidateAddrs, nums),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    // 删除设置快照余额的管理员
    public RemoteCall<TransactionReceipt> deleteAdmin(Address addr) {
        final Function function = new Function(
                FUNC_DELETEADMIN,
                Arrays.<Type>asList(addr),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    /**
     * 管理员启动投票开始
     */
    public RemoteCall<TransactionReceipt> beginVote() {
        final Function function = new Function(
                FUNC_BEGINVOTE,
                Arrays.<Type>asList(),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    /**
     * 用于批量非质押(锁定)投票  For non locked voting
     */
    public RemoteCall<TransactionReceipt> voteNoLockBatch(DynamicArray<Address> candidateAddrs,
                                                          DynamicArray<Uint256> nums) {
        final Function function = new Function(
                FUNC_VOTENOLOCKBATCH,
                Arrays.<Type>asList(candidateAddrs, nums),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    public RemoteCall<Uint256> MAX_UINT256() {
        final Function function = new Function(FUNC_MAX_UINT256,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
                }));
        return executeRemoteCallSingleValueReturn(function);
    }

    /**
     * 获取指定阶段所有候选人的详细信息
     * Get detailed information about all candidates.
     */
    public RemoteCall<Tuple3<DynamicArray<Address>, DynamicArray<Bytes32>, DynamicArray<Bytes32>>> fechAllCandidatesBySnapshotBlock(Uint256 _snapshotBlock) {
        final Function function = new Function(FUNC_FECHALLCANDIDATESBYSNAPSHOTBLOCK,
                Arrays.<Type>asList(_snapshotBlock),
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Address>>() {
                }, new TypeReference<DynamicArray<Bytes32>>() {
                }, new TypeReference<DynamicArray<Bytes32>>() {
                }));
        return new RemoteCall<Tuple3<DynamicArray<Address>, DynamicArray<Bytes32>, DynamicArray<Bytes32>>>(
                new Callable<Tuple3<DynamicArray<Address>, DynamicArray<Bytes32>, DynamicArray<Bytes32>>>() {
                    @Override
                    public Tuple3<DynamicArray<Address>, DynamicArray<Bytes32>, DynamicArray<Bytes32>> call()
                            throws Exception {
                        List<Type> results = executeCallMultipleValueReturn(function);
                        return new Tuple3<DynamicArray<Address>, DynamicArray<Bytes32>, DynamicArray<Bytes32>>(
                                (DynamicArray<Address>) results.get(0),
                                (DynamicArray<Bytes32>) results.get(1),
                                (DynamicArray<Bytes32>) results.get(2));
                    }
                });
    }

    /**
     * 获取指定阶段所有投票人的详细信息
     */
    public RemoteCall<Tuple3<DynamicArray<Address>, DynamicArray<Uint256>, DynamicArray<Uint256>>> fechAllVotersBySnapshotBlock(Uint256 _snapshotBlock) {
        final Function function = new Function(FUNC_FECHALLVOTERSBYSNAPSHOTBLOCK,
                Arrays.<Type>asList(_snapshotBlock),
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Address>>() {
                }, new TypeReference<DynamicArray<Uint256>>() {
                }, new TypeReference<DynamicArray<Uint256>>() {
                }));
        return new RemoteCall<Tuple3<DynamicArray<Address>, DynamicArray<Uint256>, DynamicArray<Uint256>>>(
                new Callable<Tuple3<DynamicArray<Address>, DynamicArray<Uint256>, DynamicArray<Uint256>>>() {
                    @Override
                    public Tuple3<DynamicArray<Address>, DynamicArray<Uint256>, DynamicArray<Uint256>> call()
                            throws Exception {
                        List<Type> results = executeCallMultipleValueReturn(function);
                        return new Tuple3<DynamicArray<Address>, DynamicArray<Uint256>, DynamicArray<Uint256>>(
                                (DynamicArray<Address>) results.get(0),
                                (DynamicArray<Uint256>) results.get(1),
                                (DynamicArray<Uint256>) results.get(2));
                    }
                });
    }

    /**
     * 获取当前阶段投票人的快照余额和总投票数
     * Get the snapshot balances and total votes of voters.
     */
    public RemoteCall<Tuple2<Uint256, Uint256>> fechVoteMainInfo() {
        final Function function = new Function(FUNC_FECHVOTEMAININFO,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
                }, new TypeReference<Uint256>() {
                }));
        return new RemoteCall<Tuple2<Uint256, Uint256>>(
                new Callable<Tuple2<Uint256, Uint256>>() {
                    @Override
                    public Tuple2<Uint256, Uint256> call() throws Exception {
                        List<Type> results = executeCallMultipleValueReturn(function);
                        return new Tuple2<Uint256, Uint256>(
                                (Uint256) results.get(0),
                                (Uint256) results.get(1));
                    }
                });
    }

    // 开始投票的区块号
    public RemoteCall<Uint256> startBlock() {
        final Function function = new Function(FUNC_STARTBLOCK,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
                }));
        return executeRemoteCallSingleValueReturn(function);
    }

    /**
     * 得到当前阶段序号（轮次）
     */
    public RemoteCall<Uint256> fechCurrentSnapshotBlockIndex() {
        final Function function = new Function(FUNC_FECHCURRENTSNAPSHOTBLOCKINDEX,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
                }));
        return executeRemoteCallSingleValueReturn(function);
    }

    // 当前票池的版本号
    public RemoteCall<Uint256> version() {
        final Function function = new Function(FUNC_VERSION,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
                }));
        return executeRemoteCallSingleValueReturn(function);
    }

    /**
     * 获取当前阶段候选人的累计总得票数，根据指定的投票轮次
     * Total number of votes obtained from candidates
     */
    public RemoteCall<Uint256> fechVoteNumForCandidate(Address candidateAddr) {
        final Function function = new Function(FUNC_FECHVOTENUMFORCANDIDATE,
                Arrays.<Type>asList(candidateAddr),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
                }));
        return executeRemoteCallSingleValueReturn(function);
    }

    /**
     * 撤回当前阶段对某个候选人的投票 Withdraw a vote on a candidate.
     */
    public RemoteCall<TransactionReceipt> cancelVoteForCandidate(Address candidateAddr,
                                                                 Uint256 num) {
        final Function function = new Function(
                FUNC_CANCELVOTEFORCANDIDATE,
                Arrays.<Type>asList(candidateAddr, num),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    // 最终获选者总数（容量，获选者数量上限）
    public RemoteCall<Uint256> capacity() {
        final Function function = new Function(FUNC_CAPACITY,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
                }));
        return executeRemoteCallSingleValueReturn(function);
    }

    /**
     * 用于非质押(锁定)投票  For non locked voting
     */
    public RemoteCall<TransactionReceipt> voteNoLock(Address candidateAddr, Uint256 num) {
        final Function function = new Function(
                FUNC_VOTENOLOCK,
                Arrays.<Type>asList(candidateAddr, num),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    public RemoteCall<DynamicArray<Uint256>> getCandidateIndexArray() {
        final Function function = new Function(FUNC_GETCANDIDATEINDEXARRAY,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Uint256>>() {
                }));
        return executeRemoteCallSingleValueReturn(function);
    }

    // 增加设置快照余额的管理员
    public RemoteCall<TransactionReceipt> addAdmin(Address addr) {
        final Function function = new Function(
                FUNC_ADDADMIN,
                Arrays.<Type>asList(addr),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    /**
     * 根据阶段序号得到阶段blockNum(取得快照的区块号)
     */
    public RemoteCall<Uint256> fechSnapshotBlockByIndex(Uint256 _index) {
        final Function function = new Function(FUNC_FECHSNAPSHOTBLOCKBYINDEX,
                Arrays.<Type>asList(_index),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
                }));
        return executeRemoteCallSingleValueReturn(function);
    }

    /**
     * 获取指定阶段候选人的总得票数，根据指定的投票轮次
     * Total number of votes obtained from candidates
     */
    public RemoteCall<Uint256> fechVoteNumForCandidateBySnapshotBlock(Address candidateAddr,
                                                                      Uint256 _snapshotBlock) {
        final Function function = new Function(FUNC_FECHVOTENUMFORCANDIDATEBYSNAPSHOTBLOCK,
                Arrays.<Type>asList(candidateAddr, _snapshotBlock),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
                }));
        return executeRemoteCallSingleValueReturn(function);
    }

    /**
     * 获取指定阶段投票人的快照余额和总投票数
     * Get the snapshot balances and total votes of voters.
     */
    public RemoteCall<Tuple2<Uint256, Uint256>> fechVoteMainInfoBySnapshotBlock(Uint256 _snapshotBlock) {
        final Function function = new Function(FUNC_FECHVOTEMAININFOBYSNAPSHOTBLOCK,
                Arrays.<Type>asList(_snapshotBlock),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
                }, new TypeReference<Uint256>() {
                }));
        return new RemoteCall<Tuple2<Uint256, Uint256>>(
                new Callable<Tuple2<Uint256, Uint256>>() {
                    @Override
                    public Tuple2<Uint256, Uint256> call() throws Exception {
                        List<Type> results = executeCallMultipleValueReturn(function);
                        return new Tuple2<Uint256, Uint256>(
                                (Uint256) results.get(0),
                                (Uint256) results.get(1));
                    }
                });
    }

    /**
     * 得到最终投票选举结果 ,必须在调用voteResult后执行
     * 该方法为常量方法，可以通过消息调用
     */
    public RemoteCall<Tuple3<DynamicArray<Address>, DynamicArray<Bytes32>, DynamicArray<Uint256>>> getVoteResult() {
        final Function function = new Function(FUNC_GETVOTERESULT,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Address>>() {
                }, new TypeReference<DynamicArray<Bytes32>>() {
                }, new TypeReference<DynamicArray<Uint256>>() {
                }));
        return new RemoteCall<Tuple3<DynamicArray<Address>, DynamicArray<Bytes32>, DynamicArray<Uint256>>>(
                new Callable<Tuple3<DynamicArray<Address>, DynamicArray<Bytes32>, DynamicArray<Uint256>>>() {
                    @Override
                    public Tuple3<DynamicArray<Address>, DynamicArray<Bytes32>, DynamicArray<Uint256>> call()
                            throws Exception {
                        List<Type> results = executeCallMultipleValueReturn(function);
                        return new Tuple3<DynamicArray<Address>, DynamicArray<Bytes32>, DynamicArray<Uint256>>(
                                (DynamicArray<Address>) results.get(0),
                                (DynamicArray<Bytes32>) results.get(1),
                                (DynamicArray<Uint256>) results.get(2));
                    }
                });
    }

    /**
     * 更新阶段轮次
     */
    public RemoteCall<TransactionReceipt> changeStageBlock(Uint256 _snapshotBlock) {
        final Function function = new Function(
                FUNC_CHANGESTAGEBLOCK,
                Arrays.<Type>asList(_snapshotBlock),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    public RemoteCall<Address> owner() {
        final Function function = new Function(FUNC_OWNER,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {
                }));
        return executeRemoteCallSingleValueReturn(function);
    }

    // 设置计算选举结果的截止轮数
    public RemoteCall<TransactionReceipt> setRound(Uint256 _round) {
        final Function function = new Function(
                FUNC_SETROUND,
                Arrays.<Type>asList(_round),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    public RemoteCall<Uint256> currentSnapshotBlock() {
        final Function function = new Function(FUNC_CURRENTSNAPSHOTBLOCK,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
                }));
        return executeRemoteCallSingleValueReturn(function);
    }

    /**
     * 获取指定阶段投票人的所有投票情况 Get all the votes of voters.
     */
    public RemoteCall<Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>> fechVoteInfoForVoterBySnapshotBlock(Address voterAddr,
                                                                                                                Uint256 _snapshotBlock) {
        final Function function = new Function(FUNC_FECHVOTEINFOFORVOTERBYSNAPSHOTBLOCK,
                Arrays.<Type>asList(voterAddr, _snapshotBlock),
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Address>>() {
                }, new TypeReference<DynamicArray<Uint256>>() {
                }));
        return new RemoteCall<Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>>(
                new Callable<Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>>() {
                    @Override
                    public Tuple2<DynamicArray<Address>, DynamicArray<Uint256>> call() throws
                            Exception {
                        List<Type> results = executeCallMultipleValueReturn(function);
                        return new Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>(
                                (DynamicArray<Address>) results.get(0),
                                (DynamicArray<Uint256>) results.get(1));
                    }
                });
    }

    /**
     * 删除候选者 Delete Candidate
     *
     * @param _candidateAddr 候选者账户地址 Candidate account address
     */
    public RemoteCall<TransactionReceipt> deleteCandidates(Address _candidateAddr) {
        final Function function = new Function(
                FUNC_DELETECANDIDATES,
                Arrays.<Type>asList(_candidateAddr),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    /**
     * 管理员启动投票结束
     * The administrator starts the voting.
     */
    public RemoteCall<TransactionReceipt> endVote() {
        final Function function = new Function(
                FUNC_ENDVOTE,
                Arrays.<Type>asList(),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    /**
     * 获取指定阶段的前一个阶段（轮次）候选人所有得票情况
     */
    public RemoteCall<Tuple4<Uint256, Uint256, DynamicArray<Address>, DynamicArray<Uint256>>> fechAllVoteResultPreStageByBlock(Uint256 _block) {
        final Function function = new Function(FUNC_FECHALLVOTERESULTPRESTAGEBYBLOCK,
                Arrays.<Type>asList(_block),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
                }, new TypeReference<Uint256>() {
                }, new TypeReference<DynamicArray<Address>>() {
                }, new TypeReference<DynamicArray<Uint256>>() {
                }));
        return new RemoteCall<Tuple4<Uint256, Uint256, DynamicArray<Address>, DynamicArray<Uint256>>>(
                new Callable<Tuple4<Uint256, Uint256, DynamicArray<Address>, DynamicArray<Uint256>>>() {
                    @Override
                    public Tuple4<Uint256, Uint256, DynamicArray<Address>, DynamicArray<Uint256>> call()
                            throws Exception {
                        List<Type> results = executeCallMultipleValueReturn(function);
                        return new Tuple4<Uint256, Uint256, DynamicArray<Address>, DynamicArray<Uint256>>(
                                (Uint256) results.get(0),
                                (Uint256) results.get(1),
                                (DynamicArray<Address>) results.get(2),
                                (DynamicArray<Uint256>) results.get(3));
                    }
                });
    }

    /**
     * 获取当前阶段投票人的所有投票情况 Get all the votes of voters.
     */
    public RemoteCall<Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>> fechVoteInfoForVoter(Address voterAddr) {
        final Function function = new Function(FUNC_FECHVOTEINFOFORVOTER,
                Arrays.<Type>asList(voterAddr),
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Address>>() {
                }, new TypeReference<DynamicArray<Uint256>>() {
                }));
        return new RemoteCall<Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>>(
                new Callable<Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>>() {
                    @Override
                    public Tuple2<DynamicArray<Address>, DynamicArray<Uint256>> call() throws
                            Exception {
                        List<Type> results = executeCallMultipleValueReturn(function);
                        return new Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>(
                                (DynamicArray<Address>) results.get(0),
                                (DynamicArray<Uint256>) results.get(1));
                    }
                });
    }

    /**
     * 用于自动投票，根据前一个轮次的投票记录程序自动投票
     */
    public RemoteCall<TransactionReceipt> voteNoLockByAdmin(Address voterAddr,
                                                            Address candidateAddr, Uint256 num) {
        final Function function = new Function(
                FUNC_VOTENOLOCKBYADMIN,
                Arrays.<Type>asList(voterAddr, candidateAddr, num),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    public RemoteCall<TransactionReceipt> resetHasAutoVote() {
        final Function function = new Function(
                FUNC_RESETHASAUTOVOTE,
                Arrays.<Type>asList(),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    // 对投票者设置快照余额的管理员
    public RemoteCall<Address> adminMap(Address param0) {
        final Function function = new Function(FUNC_ADMINMAP,
                Arrays.<Type>asList(param0),
                Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {
                }));
        return executeRemoteCallSingleValueReturn(function);
    }

    /**
     * 增加候选者  add Candidate
     *
     * @param _candidateAddr Candidate account address for return bond (HPB)
     * @param _facilityId    候选者机器设备号或者节点ID Candidate machine equipment number or node ID
     * @param _name          候选者名称  Candidate name
     */
    public RemoteCall<TransactionReceipt> addCandidate(Address _candidateAddr,
                                                       Utf8String _facilityId, Utf8String _name) {
        final Function function = new Function(
                FUNC_ADDCANDIDATE,
                Arrays.<Type>asList(_candidateAddr, _facilityId, _name),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    /**
     * 根据阶段删除候选者
     *
     * @param _candidateAddr 候选者账户地址 Candidate account address
     */
    public RemoteCall<TransactionReceipt> deleteCandidateBySnapshotBlock(Address _candidateAddr,
                                                                         Uint256 _snapshotBlock) {
        final Function function = new Function(
                FUNC_DELETECANDIDATEBYSNAPSHOTBLOCK,
                Arrays.<Type>asList(_candidateAddr, _snapshotBlock),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    // 最终选举出的候选人，便于查询
    public RemoteCall<Uint256> candidateIndexArray(Uint256 param0) {
        final Function function = new Function(FUNC_CANDIDATEINDEXARRAY,
                Arrays.<Type>asList(param0),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
                }));
        return executeRemoteCallSingleValueReturn(function);
    }

    public RemoteCall<Bool> hasAutoVote() {
        final Function function = new Function(FUNC_HASAUTOVOTE,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {
                }));
        return executeRemoteCallSingleValueReturn(function);
    }

    /**
     * 获取指定阶段候选人所有得票情况
     */
    public RemoteCall<Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>> fechAllVoteResultBySnapshotBlock(Uint256 _snapshotBlock) {
        final Function function = new Function(FUNC_FECHALLVOTERESULTBYSNAPSHOTBLOCK,
                Arrays.<Type>asList(_snapshotBlock),
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Address>>() {
                }, new TypeReference<DynamicArray<Uint256>>() {
                }));
        return new RemoteCall<Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>>(
                new Callable<Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>>() {
                    @Override
                    public Tuple2<DynamicArray<Address>, DynamicArray<Uint256>> call() throws
                            Exception {
                        List<Type> results = executeCallMultipleValueReturn(function);
                        return new Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>(
                                (DynamicArray<Address>) results.get(0),
                                (DynamicArray<Uint256>) results.get(1));
                    }
                });
    }

    public RemoteCall<TransactionReceipt> transferOwnership(Address newOwner) {
        final Function function = new Function(
                FUNC_TRANSFEROWNERSHIP,
                Arrays.<Type>asList(newOwner),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    public RemoteCall<Tuple2<Uint256, Uint256>> voteStages(Uint256 param0) {
        final Function function = new Function(FUNC_VOTESTAGES,
                Arrays.<Type>asList(param0),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
                }, new TypeReference<Uint256>() {
                }));
        return new RemoteCall<Tuple2<Uint256, Uint256>>(
                new Callable<Tuple2<Uint256, Uint256>>() {
                    @Override
                    public Tuple2<Uint256, Uint256> call() throws Exception {
                        List<Type> results = executeCallMultipleValueReturn(function);
                        return new Tuple2<Uint256, Uint256>(
                                (Uint256) results.get(0),
                                (Uint256) results.get(1));
                    }
                });
    }

    /**
     * 根据blockNum(取得快照的区块号)得到阶段序号
     */
    public RemoteCall<Uint256> fechStageIndexBySnapshotBlock(Uint256 _snapshotBlock) {
        final Function function = new Function(FUNC_FECHSTAGEINDEXBYSNAPSHOTBLOCK,
                Arrays.<Type>asList(_snapshotBlock),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
                }));
        return executeRemoteCallSingleValueReturn(function);
    }

    /**
     * 获取当前阶段候选人的投票详细情况
     */
    public RemoteCall<Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>> fechVoteResultForCandidate(Address candidateAddr) {
        final Function function = new Function(FUNC_FECHVOTERESULTFORCANDIDATE,
                Arrays.<Type>asList(candidateAddr),
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Address>>() {
                }, new TypeReference<DynamicArray<Uint256>>() {
                }));
        return new RemoteCall<Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>>(
                new Callable<Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>>() {
                    @Override
                    public Tuple2<DynamicArray<Address>, DynamicArray<Uint256>> call() throws
                            Exception {
                        List<Type> results = executeCallMultipleValueReturn(function);
                        return new Tuple2<DynamicArray<Address>, DynamicArray<Uint256>>(
                                (DynamicArray<Address>) results.get(0),
                                (DynamicArray<Uint256>) results.get(1));
                    }
                });
    }

    public static RemoteCall<Hpbballot> deploy(Web3 web3, Credentials credentials,
                                               BigInteger gasPrice, BigInteger gasLimit, BigInteger initialWeiValue,
                                               Uint256 _startBlock, Uint256 _endBlock, Uint256 _capacity, Uint256 _version) {
        String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(_startBlock, _endBlock, _capacity, _version));
        return deployRemoteCall(Hpbballot.class, web3, credentials, gasPrice, gasLimit, BINARY, encodedConstructor, initialWeiValue);
    }

    public static RemoteCall<Hpbballot> deploy(Web3 web3, TransactionManager transactionManager,
                                               BigInteger gasPrice, BigInteger gasLimit, BigInteger initialWeiValue,
                                               Uint256 _startBlock, Uint256 _endBlock, Uint256 _capacity, Uint256 _version) {
        String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(_startBlock, _endBlock, _capacity, _version));
        return deployRemoteCall(Hpbballot.class, web3, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor, initialWeiValue);
    }

    public List<CandidateAddedEventResponse> getCandidateAddedEvents(TransactionReceipt transactionReceipt) {
        List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(CANDIDATEADDED_EVENT, transactionReceipt);
        ArrayList<CandidateAddedEventResponse> responses = new ArrayList<CandidateAddedEventResponse>(valueList.size());
        for (Contract.EventValuesWithLog eventValues : valueList) {
            CandidateAddedEventResponse typedResponse = new CandidateAddedEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.candidateAddr = (Address) eventValues.getIndexedValues().get(0);
            typedResponse.facilityId = (Utf8String) eventValues.getIndexedValues().get(1);
            typedResponse.name = (Utf8String) eventValues.getNonIndexedValues().get(0);
            responses.add(typedResponse);
        }
        return responses;
    }

    public Observable<CandidateAddedEventResponse> candidateAddedEventObservable(HpbFilter filter) {
        return web3.hpbLogObservable(filter).map(new Func1<Log, CandidateAddedEventResponse>() {
            @Override
            public CandidateAddedEventResponse call(Log log) {
                Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(CANDIDATEADDED_EVENT, log);
                CandidateAddedEventResponse typedResponse = new CandidateAddedEventResponse();
                typedResponse.log = log;
                typedResponse.candidateAddr = (Address) eventValues.getIndexedValues().get(0);
                typedResponse.facilityId = (Utf8String) eventValues.getIndexedValues().get(1);
                typedResponse.name = (Utf8String) eventValues.getNonIndexedValues().get(0);
                return typedResponse;
            }
        });
    }

    public Observable<CandidateAddedEventResponse> candidateAddedEventObservable(DefaultBlockParameter startBlock,
                                                                                 DefaultBlockParameter endBlock) {
        HpbFilter filter = new HpbFilter(startBlock, endBlock, getContractAddress());
        filter.addSingleTopic(EventEncoder.encode(CANDIDATEADDED_EVENT));
        return candidateAddedEventObservable(filter);
    }

    public List<CandidateUpdatedEventResponse> getCandidateUpdatedEvents(TransactionReceipt transactionReceipt) {
        List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(CANDIDATEUPDATED_EVENT, transactionReceipt);
        ArrayList<CandidateUpdatedEventResponse> responses = new ArrayList<CandidateUpdatedEventResponse>(valueList.size());
        for (Contract.EventValuesWithLog eventValues : valueList) {
            CandidateUpdatedEventResponse typedResponse = new CandidateUpdatedEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.candidateAddr = (Address) eventValues.getIndexedValues().get(0);
            typedResponse.facilityId = (Utf8String) eventValues.getIndexedValues().get(1);
            typedResponse.name = (Utf8String) eventValues.getNonIndexedValues().get(0);
            responses.add(typedResponse);
        }
        return responses;
    }

    public Observable<CandidateUpdatedEventResponse> candidateUpdatedEventObservable(HpbFilter filter) {
        return web3.hpbLogObservable(filter).map(new Func1<Log, CandidateUpdatedEventResponse>() {
            @Override
            public CandidateUpdatedEventResponse call(Log log) {
                Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(CANDIDATEUPDATED_EVENT, log);
                CandidateUpdatedEventResponse typedResponse = new CandidateUpdatedEventResponse();
                typedResponse.log = log;
                typedResponse.candidateAddr = (Address) eventValues.getIndexedValues().get(0);
                typedResponse.facilityId = (Utf8String) eventValues.getIndexedValues().get(1);
                typedResponse.name = (Utf8String) eventValues.getNonIndexedValues().get(0);
                return typedResponse;
            }
        });
    }

    public Observable<CandidateUpdatedEventResponse> candidateUpdatedEventObservable(DefaultBlockParameter startBlock,
                                                                                     DefaultBlockParameter endBlock) {
        HpbFilter filter = new HpbFilter(startBlock, endBlock, getContractAddress());
        filter.addSingleTopic(EventEncoder.encode(CANDIDATEUPDATED_EVENT));
        return candidateUpdatedEventObservable(filter);
    }

    public List<CandidateDeletedEventResponse> getCandidateDeletedEvents(TransactionReceipt transactionReceipt) {
        List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(CANDIDATEDELETED_EVENT, transactionReceipt);
        ArrayList<CandidateDeletedEventResponse> responses = new ArrayList<CandidateDeletedEventResponse>(valueList.size());
        for (Contract.EventValuesWithLog eventValues : valueList) {
            CandidateDeletedEventResponse typedResponse = new CandidateDeletedEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.candidateAddr = (Address) eventValues.getIndexedValues().get(0);
            responses.add(typedResponse);
        }
        return responses;
    }

    public Observable<CandidateDeletedEventResponse> candidateDeletedEventObservable(HpbFilter filter) {
        return web3.hpbLogObservable(filter).map(new Func1<Log, CandidateDeletedEventResponse>() {
            @Override
            public CandidateDeletedEventResponse call(Log log) {
                Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(CANDIDATEDELETED_EVENT, log);
                CandidateDeletedEventResponse typedResponse = new CandidateDeletedEventResponse();
                typedResponse.log = log;
                typedResponse.candidateAddr = (Address) eventValues.getIndexedValues().get(0);
                return typedResponse;
            }
        });
    }

    public Observable<CandidateDeletedEventResponse> candidateDeletedEventObservable(DefaultBlockParameter startBlock,
                                                                                     DefaultBlockParameter endBlock) {
        HpbFilter filter = new HpbFilter(startBlock, endBlock, getContractAddress());
        filter.addSingleTopic(EventEncoder.encode(CANDIDATEDELETED_EVENT));
        return candidateDeletedEventObservable(filter);
    }

    public List<DoVotedEventResponse> getDoVotedEvents(TransactionReceipt transactionReceipt) {
        List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(DOVOTED_EVENT, transactionReceipt);
        ArrayList<DoVotedEventResponse> responses = new ArrayList<DoVotedEventResponse>(valueList.size());
        for (Contract.EventValuesWithLog eventValues : valueList) {
            DoVotedEventResponse typedResponse = new DoVotedEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.index = (Uint256) eventValues.getIndexedValues().get(0);
            typedResponse.voteAddr = (Address) eventValues.getIndexedValues().get(1);
            typedResponse.candidateAddr = (Address) eventValues.getIndexedValues().get(2);
            typedResponse.num = (Uint256) eventValues.getNonIndexedValues().get(0);
            typedResponse.flag = (Uint256) eventValues.getNonIndexedValues().get(1);
            responses.add(typedResponse);
        }
        return responses;
    }

    public Observable<DoVotedEventResponse> doVotedEventObservable(HpbFilter filter) {
        return web3.hpbLogObservable(filter).map(new Func1<Log, DoVotedEventResponse>() {
            @Override
            public DoVotedEventResponse call(Log log) {
                Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(DOVOTED_EVENT, log);
                DoVotedEventResponse typedResponse = new DoVotedEventResponse();
                typedResponse.log = log;
                typedResponse.index = (Uint256) eventValues.getIndexedValues().get(0);
                typedResponse.voteAddr = (Address) eventValues.getIndexedValues().get(1);
                typedResponse.candidateAddr = (Address) eventValues.getIndexedValues().get(2);
                typedResponse.num = (Uint256) eventValues.getNonIndexedValues().get(0);
                typedResponse.flag = (Uint256) eventValues.getNonIndexedValues().get(1);
                return typedResponse;
            }
        });
    }

    public Observable<DoVotedEventResponse> doVotedEventObservable(DefaultBlockParameter startBlock,
                                                                   DefaultBlockParameter endBlock) {
        HpbFilter filter = new HpbFilter(startBlock, endBlock, getContractAddress());
        filter.addSingleTopic(EventEncoder.encode(DOVOTED_EVENT));
        return doVotedEventObservable(filter);
    }

    public List<UpdateContractEventResponse> getUpdateContractEvents(TransactionReceipt transactionReceipt) {
        List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(UPDATECONTRACT_EVENT, transactionReceipt);
        ArrayList<UpdateContractEventResponse> responses = new ArrayList<UpdateContractEventResponse>(valueList.size());
        for (Contract.EventValuesWithLog eventValues : valueList) {
            UpdateContractEventResponse typedResponse = new UpdateContractEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.version = (Uint256) eventValues.getIndexedValues().get(0);
            typedResponse.startBlock = (Uint256) eventValues.getNonIndexedValues().get(0);
            typedResponse.endBlock = (Uint256) eventValues.getNonIndexedValues().get(1);
            typedResponse.capacity = (Uint256) eventValues.getNonIndexedValues().get(2);
            responses.add(typedResponse);
        }
        return responses;
    }

    public Observable<UpdateContractEventResponse> updateContractEventObservable(HpbFilter filter) {
        return web3.hpbLogObservable(filter).map(new Func1<Log, UpdateContractEventResponse>() {
            @Override
            public UpdateContractEventResponse call(Log log) {
                Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(UPDATECONTRACT_EVENT, log);
                UpdateContractEventResponse typedResponse = new UpdateContractEventResponse();
                typedResponse.log = log;
                typedResponse.version = (Uint256) eventValues.getIndexedValues().get(0);
                typedResponse.startBlock = (Uint256) eventValues.getNonIndexedValues().get(0);
                typedResponse.endBlock = (Uint256) eventValues.getNonIndexedValues().get(1);
                typedResponse.capacity = (Uint256) eventValues.getNonIndexedValues().get(2);
                return typedResponse;
            }
        });
    }

    public Observable<UpdateContractEventResponse> updateContractEventObservable(DefaultBlockParameter startBlock,
                                                                                 DefaultBlockParameter endBlock) {
        HpbFilter filter = new HpbFilter(startBlock, endBlock, getContractAddress());
        filter.addSingleTopic(EventEncoder.encode(UPDATECONTRACT_EVENT));
        return updateContractEventObservable(filter);
    }

    public List<ChangeStageBlockEventResponse> getChangeStageBlockEvents(TransactionReceipt transactionReceipt) {
        List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(CHANGESTAGEBLOCK_EVENT, transactionReceipt);
        ArrayList<ChangeStageBlockEventResponse> responses = new ArrayList<ChangeStageBlockEventResponse>(valueList.size());
        for (Contract.EventValuesWithLog eventValues : valueList) {
            ChangeStageBlockEventResponse typedResponse = new ChangeStageBlockEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.preStageBlock = (Uint256) eventValues.getIndexedValues().get(0);
            typedResponse.stageBlock = (Uint256) eventValues.getIndexedValues().get(1);
            responses.add(typedResponse);
        }
        return responses;
    }

    public Observable<ChangeStageBlockEventResponse> changeStageBlockEventObservable(HpbFilter filter) {
        return web3.hpbLogObservable(filter).map(new Func1<Log, ChangeStageBlockEventResponse>() {
            @Override
            public ChangeStageBlockEventResponse call(Log log) {
                Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(CHANGESTAGEBLOCK_EVENT, log);
                ChangeStageBlockEventResponse typedResponse = new ChangeStageBlockEventResponse();
                typedResponse.log = log;
                typedResponse.preStageBlock = (Uint256) eventValues.getIndexedValues().get(0);
                typedResponse.stageBlock = (Uint256) eventValues.getIndexedValues().get(1);
                return typedResponse;
            }
        });
    }

    public Observable<ChangeStageBlockEventResponse> changeStageBlockEventObservable(DefaultBlockParameter startBlock,
                                                                                     DefaultBlockParameter endBlock) {
        HpbFilter filter = new HpbFilter(startBlock, endBlock, getContractAddress());
        filter.addSingleTopic(EventEncoder.encode(CHANGESTAGEBLOCK_EVENT));
        return changeStageBlockEventObservable(filter);
    }

    public List<SetSnapshotBalanceEventResponse> getSetSnapshotBalanceEvents(TransactionReceipt transactionReceipt) {
        List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(SETSNAPSHOTBALANCE_EVENT, transactionReceipt);
        ArrayList<SetSnapshotBalanceEventResponse> responses = new ArrayList<SetSnapshotBalanceEventResponse>(valueList.size());
        for (Contract.EventValuesWithLog eventValues : valueList) {
            SetSnapshotBalanceEventResponse typedResponse = new SetSnapshotBalanceEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.voteStageIndex = (Uint256) eventValues.getIndexedValues().get(0);
            typedResponse.voterAddr = (Address) eventValues.getIndexedValues().get(1);
            typedResponse._snapshotBalance = (Uint256) eventValues.getNonIndexedValues().get(0);
            responses.add(typedResponse);
        }
        return responses;
    }

    public Observable<SetSnapshotBalanceEventResponse> setSnapshotBalanceEventObservable(HpbFilter filter) {
        return web3.hpbLogObservable(filter).map(new Func1<Log, SetSnapshotBalanceEventResponse>() {
            @Override
            public SetSnapshotBalanceEventResponse call(Log log) {
                Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(SETSNAPSHOTBALANCE_EVENT, log);
                SetSnapshotBalanceEventResponse typedResponse = new SetSnapshotBalanceEventResponse();
                typedResponse.log = log;
                typedResponse.voteStageIndex = (Uint256) eventValues.getIndexedValues().get(0);
                typedResponse.voterAddr = (Address) eventValues.getIndexedValues().get(1);
                typedResponse._snapshotBalance = (Uint256) eventValues.getNonIndexedValues().get(0);
                return typedResponse;
            }
        });
    }

    public Observable<SetSnapshotBalanceEventResponse> setSnapshotBalanceEventObservable(DefaultBlockParameter startBlock,
                                                                                         DefaultBlockParameter endBlock) {
        HpbFilter filter = new HpbFilter(startBlock, endBlock, getContractAddress());
        filter.addSingleTopic(EventEncoder.encode(SETSNAPSHOTBALANCE_EVENT));
        return setSnapshotBalanceEventObservable(filter);
    }

    public List<VoteNoLockByAdminInvokeDoVotedEventResponse> getVoteNoLockByAdminInvokeDoVotedEvents(TransactionReceipt transactionReceipt) {
        List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(VOTENOLOCKBYADMININVOKEDOVOTED_EVENT, transactionReceipt);
        ArrayList<VoteNoLockByAdminInvokeDoVotedEventResponse> responses = new ArrayList<VoteNoLockByAdminInvokeDoVotedEventResponse>(valueList.size());
        for (Contract.EventValuesWithLog eventValues : valueList) {
            VoteNoLockByAdminInvokeDoVotedEventResponse typedResponse = new VoteNoLockByAdminInvokeDoVotedEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.voterAddr = (Address) eventValues.getNonIndexedValues().get(0);
            typedResponse.candidateAddr = (Address) eventValues.getNonIndexedValues().get(1);
            typedResponse.num = (Uint256) eventValues.getNonIndexedValues().get(2);
            responses.add(typedResponse);
        }
        return responses;
    }

    public Observable<VoteNoLockByAdminInvokeDoVotedEventResponse> voteNoLockByAdminInvokeDoVotedEventObservable(HpbFilter filter) {
        return web3.hpbLogObservable(filter).map(new Func1<Log, VoteNoLockByAdminInvokeDoVotedEventResponse>() {
            @Override
            public VoteNoLockByAdminInvokeDoVotedEventResponse call(Log log) {
                Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(VOTENOLOCKBYADMININVOKEDOVOTED_EVENT, log);
                VoteNoLockByAdminInvokeDoVotedEventResponse typedResponse = new VoteNoLockByAdminInvokeDoVotedEventResponse();
                typedResponse.log = log;
                typedResponse.voterAddr = (Address) eventValues.getNonIndexedValues().get(0);
                typedResponse.candidateAddr = (Address) eventValues.getNonIndexedValues().get(1);
                typedResponse.num = (Uint256) eventValues.getNonIndexedValues().get(2);
                return typedResponse;
            }
        });
    }

    public Observable<VoteNoLockByAdminInvokeDoVotedEventResponse> voteNoLockByAdminInvokeDoVotedEventObservable(DefaultBlockParameter startBlock,
                                                                                                                 DefaultBlockParameter endBlock) {
        HpbFilter filter = new HpbFilter(startBlock, endBlock, getContractAddress());
        filter.addSingleTopic(EventEncoder.encode(VOTENOLOCKBYADMININVOKEDOVOTED_EVENT));
        return voteNoLockByAdminInvokeDoVotedEventObservable(filter);
    }

    public List<ReceivedHpbEventResponse> getReceivedHpbEvents(TransactionReceipt transactionReceipt) {
        List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(RECEIVEDHPB_EVENT, transactionReceipt);
        ArrayList<ReceivedHpbEventResponse> responses = new ArrayList<ReceivedHpbEventResponse>(valueList.size());
        for (Contract.EventValuesWithLog eventValues : valueList) {
            ReceivedHpbEventResponse typedResponse = new ReceivedHpbEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.sender = (Address) eventValues.getIndexedValues().get(0);
            typedResponse.amount = (Uint256) eventValues.getNonIndexedValues().get(0);
            responses.add(typedResponse);
        }
        return responses;
    }

    public Observable<ReceivedHpbEventResponse> receivedHpbEventObservable(HpbFilter filter) {
        return web3.hpbLogObservable(filter).map(new Func1<Log, ReceivedHpbEventResponse>() {
            @Override
            public ReceivedHpbEventResponse call(Log log) {
                Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(RECEIVEDHPB_EVENT, log);
                ReceivedHpbEventResponse typedResponse = new ReceivedHpbEventResponse();
                typedResponse.log = log;
                typedResponse.sender = (Address) eventValues.getIndexedValues().get(0);
                typedResponse.amount = (Uint256) eventValues.getNonIndexedValues().get(0);
                return typedResponse;
            }
        });
    }

    public Observable<ReceivedHpbEventResponse> receivedHpbEventObservable(DefaultBlockParameter startBlock,
                                                                           DefaultBlockParameter endBlock) {
        HpbFilter filter = new HpbFilter(startBlock, endBlock, getContractAddress());
        filter.addSingleTopic(EventEncoder.encode(RECEIVEDHPB_EVENT));
        return receivedHpbEventObservable(filter);
    }

    public static Hpbballot load(String contractAddress, Web3 web3, Credentials credentials,
                                 BigInteger gasPrice, BigInteger gasLimit) {
        return new Hpbballot(contractAddress, web3, credentials, gasPrice, gasLimit);
    }

    public static Hpbballot load(String contractAddress, Web3 web3,
                                 TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
        return new Hpbballot(contractAddress, web3, transactionManager, gasPrice, gasLimit);
    }

    public static class CandidateAddedEventResponse {
        public Log log;

        public Address candidateAddr;

        public Utf8String facilityId;

        public Utf8String name;
    }

    public static class CandidateUpdatedEventResponse {
        public Log log;

        public Address candidateAddr;

        public Utf8String facilityId;

        public Utf8String name;
    }

    public static class CandidateDeletedEventResponse {
        public Log log;

        public Address candidateAddr;
    }

    public static class DoVotedEventResponse {
        public Log log;

        public Uint256 index;

        public Address voteAddr;

        public Address candidateAddr;

        public Uint256 num;

        public Uint256 flag;
    }

    public static class UpdateContractEventResponse {
        public Log log;

        public Uint256 version;

        public Uint256 startBlock;

        public Uint256 endBlock;

        public Uint256 capacity;
    }

    public static class ChangeStageBlockEventResponse {
        public Log log;

        public Uint256 preStageBlock;

        public Uint256 stageBlock;
    }

    public static class SetSnapshotBalanceEventResponse {
        public Log log;

        public Uint256 voteStageIndex;

        public Address voterAddr;

        public Uint256 _snapshotBalance;
    }

    public static class VoteNoLockByAdminInvokeDoVotedEventResponse {
        public Log log;

        public Address voterAddr;

        public Address candidateAddr;

        public Uint256 num;
    }

    public static class ReceivedHpbEventResponse {
        public Log log;

        public Address sender;

        public Uint256 amount;
    }
}
